Listbox Key

Jelmer

Regular
Joined
Jan 11, 2006
Messages
96
I've got a listbox.
The listbox has a x count of items.

If i press the button on one of it there is some code executed.
But if number 2 is selected and i press the up or down keys. The other item is getting bleu.. but the code that should be executed doesnt.

If i do the code (fill_customer();) on the onload part, it is executed, but for the old one, so it runs 1 event after.

My code:

Code:
        private void lstKlant_KeyDown(object sender, KeyEventArgs e)
        {
            fill_customer();
        }
        private void lstKlant_KeyPress(object sender, KeyPressEventArgs e)
        {
            fill_customer();
        }
 
I'm slightly confused, it sounds like your trying to run code when a new item is selected, if this is the case you can use the OnSelectedIndexChanged method. If this isn't what your attempting todo, then I'm misunderstanding.
 
Back
Top