Hello all,

I have a dataset used to populate a datagrid. I wish to bind a Binding navigator to the datagrid after its created.

I know how to do it using the wizard and with almost no code but i want to do it code wise so i can see what happens in the background. (does that make sence?) here is my simple code.

VB Code:
  1. Imports System.Data
  2. Imports System.Data.SqlClient
  3.  
  4.  
  5. Public Class Inventory
  6.  
  7.     'Dim objAdapter As New SqlDataAdapter
  8.     Dim objDataset As New DataSet
  9.  
  10.  
  11.  
  12.  
  13.     Private Function getConnectionString() As String
  14.         Return "***edited for Safety***"
  15.     End Function
  16.     Private Function getSqlString() As String
  17.         Return "SELECT * FROM EQ_Equipment"
  18.     End Function
  19.  
  20.     Private Sub Inventory_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  21.         'Dim sqlConnection As SqlConnection = New SqlConnection(getConnectionString)
  22.         Dim objAdapter As New SqlDataAdapter(getSqlString, getConnectionString)
  23.         Dim objdataset As New DataSet
  24.         objAdapter.Fill(objdataset, "inventory")
  25.  
  26.         dgvInventory.DataSource = objdataset
  27.         dgvInventory.DataMember = "inventory"
  28.  
  29.     End Sub
  30.  
  31.  
  32. End Class