Rewrite the example shown in Figure 8-5 using VB.NET.

Rewrite the example shown in Figure 8-5 using VB.NET.

Step-by-Step Solution

Solution 1

Program Plan:

• Create a database in MS Access and name it ‘literacy.accdb’ as per the details provided in figure 7-15 adult literacy program.

• In Visual Basic 2010, start a new project of type ‘Windows Form Application’. Give it a name DB_Hoffer.

• Open ‘Database Explorer’, click on ‘Connect to database’ button to open ‘Add Connection’ wizard.

o Choose Data source as ‘Microsoft Access Database File (OLE DB)’.

o In Database File Name text box browse to the ‘literacy.accdb’

o Do not specify a user name and password.

o Click on ‘Test Connection’ button to test the connection.

o Click on ‘Ok’ button to exit the wizard.

Picture 1

• Click on the ‘Data’ Menu. Click on “Add a New Data Source’.

• The ‘Data Source Configuration Wizard’ will open.

o Here choose ‘Database’ for ‘Choose a data source type’ and click on ‘Next’.

o On ‘choose a database model’ choose ‘dataset’ and click on ‘Next’.

o On ‘Choose a data connection’ screen, choose the ‘literacy.accdb’. Notice when you open the connection string it specifies ‘Provider=Microsoft.ACE.OLEDB.12.0;Data Source="C:\Users\Sangeeta Yadav\Documents\literacy.accdb"’

o Click on ‘Next; and click on ‘yes’ to add it to the current project.

o Save the connection string. Click on ‘Next’

o In ‘choose your Database Objects’, choose tables. And click on ‘Finish’. Here’s a screen shot of the Data source tab at this stage.

Picture 6

• The Tables and attributes can now be seen in ‘Data Source’ tab.

• Now open the ‘ToolBox’ click the ‘Data’ tab, Drag a ‘DataGridView’ to the form. The ‘DataGridView Tasks’ opens. Here, in ‘Choose Data Source’ drop down menu, choose ‘Project data source’, choose ‘lteracyDataSet’, choose ‘STUDENT’ table. This screenshot for this is given below.

Picture 3

Form Design:

View the form design in the IDE.

Picture 4

Set the Solution and form control properties in the Properties window as follows:








Project File

My Project

Form File

File Name


Form Class



LiteracyStudent Form


Student Information


Public Class LiteracyStudent

Private Sub LiteracyStudent_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me.STUDENTTableAdapter.Fill( Me.LiteracyDataSet.STUDENT)

End Sub

End Class

Sample Output:

Picture 5

Add your Solution
Textbook Solutions and Answers Search