Bind datatable to combobox (with plain vb code and t-sql)
Posted on 2008-06-12
What I want to achieve is quite simple (but I don't know how). I want the user to give the change to pick a customer name with a combo box and show the details (address, phone, ...) in textboxes (or labels). What I don't want is using the build-in custom tools of VB (like bindingsources ..)
I think the best way to reach my goal is:
1. select the customer table in SQL (SELECT * FROM Customers ORDER BY Name)
2. create and open the connection, create and execute the command, use a data-adapter to fill the datatable (this all is not the problem)
3. bind the datatable to the combobox so the pointer in de datatable changes whenever the user chooses another customer (This is the part where I'm stuck).
Any ideas? Or perhaps I'm completely wrong and should I better use data sources, and binding sources?
I'm upgrading a big VB 6 project to VB 2008 and I never used dataenvironments in VB 6 too.