Navigate through Datatable bound to datagridview RRS feed

  • Question

  • Please I am using vb.net 2015 and  I have a datagridview bound to a datatable and data can be fetched without any problem.

    Now, if the records returned are more than 200, I want to retrieve 200 at a time then i will have a next button on the datagridview form which will be clicked to load the datagridview for the remaining records. So assuming there are thousand records, the first time the grid loads, it will have 200 records and the next button will be clicked to to display another 200 records, etc before it finishes. Below is the code that bounds the datagridview but i don't know how to do the navigation. Please help and thanks in advance.

    Dim table As New DataTable Dim com As SqlCommand Dim QueryMailRefNo = "Select * from File_Movement where File_No=@File_No Order by fdate desc, ftime desc" com = New SqlCommand(QueryMailRefNo, SQLCon) com.Parameters.AddWithValue("File_No", frmHome.txtFileNo.Text) daAdapter = New SqlDataAdapter(com) daAdapter.Fill(table) If table.Rows.Count > 200 Then frmHome.dgvTracking.AutoGenerateColumns = False frmHome.dgvTracking.DataSource = table End If Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click End Sub

    • Edited by Benniit Monday, July 18, 2016 10:15 AM
    Monday, July 18, 2016 10:13 AM


All replies