Combobox - what event fires when I blank it?

J Trahair

Well-known member
Joined
May 14, 2008
Messages
175
Location
Spain
Programming Experience
10+
I have just realised that ComboBoxes don't have a Change event. I have a combobox filled with a few items, eg. Bakery, Deli, Fruit & Veg, etc. Choose one of these items, all the related items show in the dgv.

However, when I blank the text in the Combobox (press Delete key whilst Combobox has the focus), what event fires so I can blank the dgv? The combobox does not contain a Blank item. Even if it does, the Blank item only fires the ComboBox1_SelectedIndexChanged when the user scrolls down to, or clicks on, the blank value.

I want to clear the dgv when the user blanks the combobox without necessarily changing the selection index.

How can I do this? Thanks.
 

As a small note, I was always lead to believe it is bad practice to use the KeyDown for something like this (irrespective of control type), as you will get multiple repetitions if the key is held down. On this basis, I always try and use KeyUp.
 
Back
Top