My combobox contains 'Control', 'Alt' & 'Shift'. My predefined string in the settings class is 'Control'.
How do i compare those 2 Strings :
Because i want to save the changed selectedItem in my settings class, so whenever i start the application again it should load the new SelectedItem in the Combobox.
Edit: Code looking actually like this, but it wont work.
if (cmbModifier.SelectedItem.ToString() != ClipboardPro.Properties.Settings.Default.SavedModifier.ToString())
{
modkey = cmbModifier.SelectedItem.ToString();
ClipboardPro.Properties.Settings.Default.SavedModifier = modkey;
ClipboardPro.Properties.Settings.Default.Save();
}
the SelectedItem
property returns the full listitem object you used to fill your combobox. If you are looking for the value, you can use SelectedValue.ToString()
if (cmbModifier.SelectedValue.ToString() != ClipboardPro.Properties.Settings.Default.SavedModifier.ToString())
{
modkey = cmbModifier.SelectedValue.ToString();
ClipboardPro.Properties.Settings.Default.SavedModifier = modkey;
ClipboardPro.Properties.Settings.Default.Save();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.