listbox datatable selected item

C

cptkirkh

I havea listbox bound to a datatable. When the form loads it thinks
the first item is selected. Is there anyway to tell the listbox when
it loads not to select the first time automatically?
 
S

Stephany Young

In the form's Load event handler:

Fill the DataTable

Set the SelectedIndex property of the ListBox to -1

Add the desired event handlers to the corresponding events of the ListBox

In this case Do NOT 'wire' up the event handlers for the ListBox at design
time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top