Hi All
In this tutorial I will show you how to populate text boxes with a dataset by selecting an object from a Combo Box. With this method you will not have to write any code. I Have used VB.net Express in conjunction with MSSQL express 2005.
1. Open the VB express IDE and select
File and
New project.
Select Windows forms Application and name it
MyComboDB press
OK. You should now have form1 in your IDE.
2. Next we have to add a database to the project. Right click on MyComboDB and select
Add then
New Item. Select
Serviced Based Database and then
Add. You should now have a database object in the solutions explorer and also the Database explorer window on the left hand side.
Note: The Data source window is activated at this point just press cancel

3. Expand the Database1.mdf and then right click the Tables folder, select
Add new Table. Add this data
Column , Data Type, Allow Nulls[ModelID], int, No,
Set this as Primary Key[Make], nchar(10), No
[EngineSize], nchar(10), No
[NumDoors], nchar(10), No
To set modelID as the primary key select the modelID row then press the small gold key on the main menu strip. To set the increments scroll down the
column properties tabbed window till you see the
identity Specification, expand this then click into the combo box next to
Isidentity and select
Yes, the identity seed and increment should be set to 1 which is ok. Save the table and call it
Models.
4. Expand the table’s folder in the Database explorer window and right click on our Models table select
show table data and add this information to the appropriate columns.
Note: The ModelID number will be automatically created
Make, EngineType , NumDoorsFord, 2000, 5
Mustang, 4000, 2
Nissan, 1000, 4
Save and close.

5. We next have to add a dataset to the project in the solutions explorer. Right click on myComboDB and select
Add then
New Item. Select
Dataset and then
Add. You should now have a dataset in the solutions explorer and the Dataset1 tab will be open.
6. We need to add the Models table to the Dataset, we do this by selecting the
Models table in the data connections window and drag the table onto the
Dataset1 tabbed page. You should now have a Models Table Adaptor in the Dataset with an SQL fill query at the bottom of the table which has been automatically generated. Save the Dataset.

7. Select form1 and drag a Combo box onto it from the toolbox
8. We now need to add the Dataset1 to the combo box and the form. In the solutions explorer open the
Data sources window. Expand the Dataset1 to show the
Models table, highlight the Models table and from the drop down menu select
Details. Now highlight the Models table and drag onto the form1 and drop it on to the
Combo box be careful not drop it on the form.

8. Repeat this process only this time drop the
Models table onto the
form. You will see appear automatically textboxes and labels on the form. You now have a working database. Run the application and select a model from the
combo box, the text boxes on the form should now update automatically. If you look at the form1 code you will see that only one line of code has been added. If you so wish you could add a button to this form linking to a second form
(Form2). If you drag the
Models dataset onto form2 this will give you the ability to
add delete & save the records which will automatically
add or delete records from the Combo box. If you do this you will need to add a refresh button to Form1 to update the data, but I will let you figure this all of this out.

Thanks for your time and I hope this tutorial has been of interest to you.