C# Windows Form Databound Listbox Problem - Help!!

W

Wade Beasley

I have developed a Windows Forms application with C#. On the windows
form I have a master list box with the names of people the user can
select from and when selected it calls a Select in SQL server to gather
the appropriate information. It is then populated onto a multi-tab
portion on the right of the screen. On the 3rd tab I have 2
multi-select listboxes. The problem is on the first time I go to the
tab for the first name the 2 multi-select listboxes are not highlighting
the items that should be. If the user selects another name then
reselects the first one, it works okay. I can not figure out why it is
not highlighting on the first time????? I have tried doing refreshes
on the controls when I load the data. I have tried refreshing the tabs
too. Nothing seems to work. It is like it lost context the first time.
I am about ready to pull out the few hairs on my head. Any help would
greatly be appreciated.

Thanks,
Wade Beasley
 
D

Dominic Paquette

after you filled the listbox containing the names did you try setting the
selection explicitlly like this for example:

fillNamesListBox();
myListBox.SelectedItem = 0;
 

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