Beginning VB.Net Chapter 16
I read through Chapter 16 'Database Programming with SQL Server and ADO.NET' and I am stumped on just one part, hopefully you can help me out.
I have a form that connects to a SQL database, and I have a combo box on this form (this combo box has a list of facilities that a user would be able to choose one facility out of the combo box). I am filling the combo box with a SQL statement - works perfectly.
The rest of the data on the form, I am using a different SQL statement to populate my text boxes. I am also using this same SQL statement to retrieve the facility name for the combo box.
The combo box is serving double duty, as they usually do, it is giving me a list of all of the facilities in a drop down, and it is also returning the facility name of the record that I am retrieving from SQL.
Everything works perfectly, but. . .
When I navigate through my records, sometimes the combo box (facility name) does not change with what the facility name should be for that particular record, it's almost like it sticks on the same facility name sometimes. The facility ID (different text box) changes with every record but the combo box sometimes doesn't.
I did some troubleshooting. . .
If I put a text box in place of the combo box it works correctly, but this does not solve the problem of the user being able to select a facility, hence the need for a combo box.
Please help. I have been wasting too much time trying to figure this out.