Combobox event
-
Hi , Is there any event for both the textchange and selectindexchange in combobox {that event must fire when we made any change in the text as well as selectindexchange
-
Hi , Is there any event for both the textchange and selectindexchange in combobox {that event must fire when we made any change in the text as well as selectindexchange
There isn't, but just use both events and keep track of them yourself, like:
bool textChanged = false;
bool indexChanged = false;void TextChanged()
{
if(!indexChanged)
textChanged = true;
else {
indexChanged = false
EventsFired();
}
}void IndexChanged()
{
if(!textChanged)
indexChanged = true;
else {
textChanged = false
EventsFired();
}}
void EventsFired()
{
//Main code
}My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
-
Hi , Is there any event for both the textchange and selectindexchange in combobox {that event must fire when we made any change in the text as well as selectindexchange
there are no events for handle both events, specify event handler like this:
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);then you perfom actions in
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
// do something
}this done because both events are apply from
System.EventHandler
dhaim programming is a hobby that make some money as side effect :)