VB.NET How to Paging/Sorting in DataGridView

VB.NET for beginners : How to create simple application paging and sorting in a datagridview examples for beginners.

VB.NET How - How to create simple application to paging and sorting data from MySQL Database (other database) in a DataGridView using .NET language? this session will show you how a DataGridView Class will allow customization of cells, rows, columns, and borders through the use of its properties.

Please Read :
  1. VB.NET Insert, Update, Delete Data From DataGridView Using MySQL Database
  2. How to Export DataGridView to PDF Using DataTable MySQL Database 
  3. How to Filter DataGridView Using TextBox and MySQL Database
The paging simple application will show data value from MySQL database and show it into a DataGridView with a filter data type as integer, 15 is max count of the value will display in DataGridview page one by one, just follow this tuotorial.

Paging DataGridView

Create a new project, rename it with "PagingDataGridView" and at the Form1.vb just design look like this form :
How to Paging/Sorting in DataGridVie

Source Code DataGridView Paging Example

just write all source code below to sorting or paging our value from MySQL Database :

Imports System.Data.Odbc ' using ODBC namespace
Public Class Form1
    Dim conn As OdbcConnection ' declare for our connection
    Dim Da As OdbcDataAdapter ' declare for Data Adapter
    Dim Ds As DataSet ' declare for dataset
    Dim Filter As Integer ' for max value to show the data/paging 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ' load data button
        ' you must have a Database before
        ' i use MySQL database for this application
        ' i'll create connection using Odbc
        ' set connection using ODBC
        conn = New OdbcConnection("DSN=k13new;MultipleActiveResultSets=True")
        ' create SQL query to show data from MySQL Database
        Dim sql As String = "SELECT * FROM biodata order by idsiswa"
        Da = New OdbcDataAdapter(sql, conn)
        Ds = New DataSet

        ' open connection
        conn.Open()
        Da.Fill(Ds, Filter, 15, "biodata")
        ' max Count of data will show at one page is 15
        ' close connection
        conn.Close()
        DataGridView1.DataSource = Ds
        DataGridView1.DataMember = "biodata"
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ' prev button
        Filter = Filter - 15
        If Filter <= 0 Then
            Filter = 0
        End If
        Ds.Clear()
        Da.Fill(Ds, Filter, 15, "biodata")
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        ' next button
        Filter = Filter + 15
        Ds.Clear()
        Da.Fill(Ds, Filter, 15, "biodata")
    End Sub
End Class

If you still confused with this tutorial, please see video how to create DataGridView Paging Example below :

Video Tutorials


COMMENTS

Next Recomended


Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,84,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,5,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: VB.NET How to Paging/Sorting in DataGridView
VB.NET How to Paging/Sorting in DataGridView
VB.NET for beginners : How to create simple application paging and sorting in a datagridview examples for beginners.
https://4.bp.blogspot.com/-Me9q_nCQ61w/V5O4fweK_dI/AAAAAAAACH8/Tf3q3uAYahoqpa-AKgrJEo6jSt2G5507ACLcB/s320/paging-datagridview.jpg
https://4.bp.blogspot.com/-Me9q_nCQ61w/V5O4fweK_dI/AAAAAAAACH8/Tf3q3uAYahoqpa-AKgrJEo6jSt2G5507ACLcB/s72-c/paging-datagridview.jpg
KODE AJAIB
https://www.kodeajaib.com/2016/07/how-to-paging-sorting-in-datagridview.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/07/how-to-paging-sorting-in-datagridview.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy