Pages

Monday, 5 June 2017

Gridview FIll VB.net

Dynamic fill data gridview using VB.net


Public Sub fill_gridview(ByRef dt As DataGridView, ByVal sql As String)
        Dim con As New OleDbConnection(getconstr)
        Dim da As New OleDbDataAdapter(sql, con)
        Dim ds As New DataSet
        Try

            da.Fill(ds, "My_table_temp_name")
            dt.DataSource = ds.Tables("My_table_temp_name")

        Catch ex As Exception
            MsgBox("Grid Filling Error from from class function" & vbCrLf & ex.Message)
        End Try
    End Sub

No comments:

Post a Comment