1. Computing

Chapter 20 - Data Presentation Using the DataGrid Control

By

9 of 10

The Code to Process Our View

The only changes have been displayed in bold here. I also changed the VB.NET programming to execute the DsInstructors1.Clear() method in a Form1_Load event so each Data Grid would remain loaded. Here's the code:

~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub btnLoad_Click( _
  ByVal sender As System.Object, _
  ByVal e As System.EventArgs) _
  Handles btnLoad.Click
  OleDbDataAdapter1.Fill(DsInstructors1)
End Sub

Private Sub btnLoadView_Click( _
  ByVal sender As System.Object, _
  ByVal e As System.EventArgs) _
  Handles btnLoadView.Click
  OleDbDataAdapter2.Fill(DsInstructors1)
End Sub

Private Sub Form1_Load( _
  ByVal sender As Object, _
  ByVal e As System.EventArgs) _
  Handles MyBase.Load
  DsInstructors1.Clear()
End Sub
~~~~~~~~~~~~~~~~~~~~~~~~~

When you complete this, you're probably ready to try lots of different programs using the Students database.

©2014 About.com. All rights reserved.