1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 20 - Data Presentation Using the DataGrid Control

By Dan Mabbutt, About.com

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.

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Data Presentation Using the DataGrid Control

©2009 About.com, a part of The New York Times Company.

All rights reserved.