Click here to Skip to main content
16,016,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Sorry if this is a simple question, but how do I raise a SelectedValueChanged event on a toolstrip combobox? In the combobox properties I can see a list of events, but not the SelectedValueChanged event.

I need to trigger some code when a user changes the selected item, not when the combobox is clicked and the first item is selected automatically (a SelectedIndexChanged event)

Thanks

What I have tried:

C#

private void bxDEAL_SELECT_SelectedIndexChanged(object sender, EventArgs e) //need SelectedValueChanged here instead
{

// trigger code

}
C#

Posted
Updated 22-May-16 23:11pm
Comments
Karthik_Mahalingam 23-May-16 5:16am    
what is the problem in using SelectedIndexChanged event ?

1 solution

The ToolStripComboBox doesn't have a SelectedValue changed - it only has the SelectedIndexChanged event.
ToolStripComboBox Events (System.Windows.Forms)[^]
Even if it did, the first click would raise it in the same way that it raises an index change.
To avoid the "first call" if it's a problem, add a bool to your container class and check it in the event handler then reset it.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900