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:
Imports System.Data Imports System.Data.SqlClient Public Class Inventory 'Dim objAdapter As New SqlDataAdapter Dim objDataset As New DataSet Private Function getConnectionString() As String Return "***edited for Safety***" End Function Private Function getSqlString() As String Return "SELECT * FROM EQ_Equipment" End Function Private Sub Inventory_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Dim sqlConnection As SqlConnection = New SqlConnection(getConnectionString) Dim objAdapter As New SqlDataAdapter(getSqlString, getConnectionString) Dim objdataset As New DataSet objAdapter.Fill(objdataset, "inventory") dgvInventory.DataSource = objdataset dgvInventory.DataMember = "inventory" End Sub End Class


Reply With Quote
