Load Data Into Datagrid in vb.net source code

Load Data Into Data Grid in vb.net source code

Inventory Management System in Vb.net with Full Source Code

This is easy way to load data into data grid

Fast Loading into Data Grid


 Public Function GetData(ByVal sqlCommand As String) As DataTable

        Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APPDataBasePath & ";Jet OLEDB:Database Password=prakash"

        Dim northwindConnection As OleDb.OleDbConnection = New OleDb.OleDbConnection(connectionString)
        Dim command As New OleDb.OleDbCommand(sqlCommand, northwindConnection)
        Dim adapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter()
        adapter.SelectCommand = command
        Dim table As New DataTable
        table.Locale = System.Globalization.CultureInfo.InvariantCulture
        Return table

    End Function

How To Use

       SqlStr = "select * from Daybook"
        Dim binding2 As New BindingSource
        With Me.DataGridView2
            ' Automatically generate the DataGridView columns.
            .AutoGenerateColumns = True
            binding2.DataSource = GetData(SqlStr)
            .DataSource = binding2
        End With

For POS System in VB.NET Source Code

: Please Contact :