I'm trying to compare two strings, the selected field from a Combobox and just a string. I tried several things but for some reason it always hits the else statement. Why? I already tried to use Platform::string instead of std::string but no result. The selected input is "Nvidia".
void N_Body::MainPage::comboBox_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e)
{
comboBox_2->Items->Clear();
Object^ selectedItem = comboBox_2->SelectedItem;
Platform::String^ Nvidia("Nvidia");
//if (selectedItem->ToString() == "Nvidia") doesn't seem to work either..
if (selectedItem->ToString() == Nvidia) {
comboBox_2->Items->InsertAt(0, "CUDA");
comboBox_2->Items->InsertAt(1, "C++ AMP");
}
else {
comboBox_2->Items->InsertAt(0, "C++ AMP");
}
}
Aucun commentaire:
Enregistrer un commentaire