VB.NET How to Filter DataGridView Using TextBox and MySQL Database

VB.NET how to beginner - how to filter/search data in DataGridView from a textbox using MySQL Connections Database? vb.net for beginner you can download full source code filter or search value DataGridView .NET

VB.NET Programming - How to search value or filter data in DataGridView from a textbox using database MySQL? this tutorial will be show you how to make simple application with visual studio 2015 filter DataGrid from textbox. before doing this tutorial you must have a database (MySQL) database and we will make a connection using ODBC Driver, all tutorial hasbeen posted on "hc-kr.com", just type your strings and hit enter in the Search box above. or you can follow this links ..

Read : How to create MySQL Database?
How to Make a Connection Using MySQL database and ODBC Connection?
How to Insert data Into DataGridView?

Langsung saja, kita akan membuat aplikasi sederhana tentang bagaimana cara mencari sebuah data dalam datagridview berdasarkan string yang dituliskan di sebuah textbox. lihat tutorialnya.

Project Filter Value DataGridView From TextBox


Buatlah sebuah project baru dan beri nama "FilterGridView" dan pada Form1.vb desain tampilannya seperti gambar berikut :

Filter DataGridView Using TextBox

Selanjutnya mari kita membuat koneksi ke database dengan menggunakan ODBC class, karena dengan menggunakan koneksi ODBC saya rasa akan lebih mudah dalam mengembangkan sebuah aplikasi besar, dan mari kita biasakan.

buatlah sebuah module baru dan beri nama ModuleConnection.Vb dan tuliskan source code berikut :

Source Code ModuleConnection.vb

Imports System.Data.Odbc
Module ModuleConnection
    ' for this tutorial, we must have a database MySQL before
    ' then create a connection using ODBC drivers
    ' i have a database MySQL, you must create it before.

    Public Connections As OdbcConnection ' declarations our connection
    Sub openConnection()
        Try
            Connections = New OdbcConnection("DSN=java_db;MultipleActiveResultSets=True")
            If Connections.State = ConnectionState.Closed Then
                ' open connection
                Connections.Open()
            End If
        Catch ex As Exception
            MsgBox("Error at " & ex.ToString)
        End Try
    End Sub
End Module

Source Code Form Filter Data

Imports System.Data.Odbc
Public Class Form1
    Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
        openConnection() ' open our connection before
        Dim da As OdbcDataAdapter ' declaration data adapter
        Dim dt As DataTable ' declaration data table
        da = New OdbcDataAdapter("SELECT * FROM biodata where nama like '" & TextBox1.Text & "%'", Connections)
        dt = New DataTable
        da.Fill(dt)
        DataGridView1.DataSource = dt
        Connections.Close() ' close connections
        da.Dispose() ' close data adapter
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        openConnection() ' open our connection
        Dim da As OdbcDataAdapter
        Dim ds As DataSet
        da = New OdbcDataAdapter("SELECT * FROM biodata", Connections)
        ds = New DataSet

        da.Fill(ds, "biodata")
        DataGridView1.DataSource = ds.Tables("biodata")
        Connections.Close() 'close our connection
        da.Dispose() ' close data adapter
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Close()
    End Sub
End Class
Jika selesai, maka kamu sudah berhasil mem-filter data di DataGridView dari TextBox menggunakan database MySQL. jika masih bingung dengan tutorial diatas, langsung saja lihat video tutorial berikut ini :

Video Tutorial  Filter DataGridView Using TextBox



Download Source Code Filter DataGridView
Download Database DataGridView

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 Filter DataGridView Using TextBox and MySQL Database
VB.NET How to Filter DataGridView Using TextBox and MySQL Database
VB.NET how to beginner - how to filter/search data in DataGridView from a textbox using MySQL Connections Database? vb.net for beginner you can download full source code filter or search value DataGridView .NET
https://1.bp.blogspot.com/-y70t6tFapus/V0ca_72FgNI/AAAAAAAAByQ/9v5TBCXfzFoKm_Ca-q9PaClDi574R91PwCLcB/s320/vb-net-fillter-datagridview.jpg
https://1.bp.blogspot.com/-y70t6tFapus/V0ca_72FgNI/AAAAAAAAByQ/9v5TBCXfzFoKm_Ca-q9PaClDi574R91PwCLcB/s72-c/vb-net-fillter-datagridview.jpg
KODE AJAIB
https://www.kodeajaib.com/2016/05/vbnet-how-to-filter-datagridview-using.html
https://www.kodeajaib.com/
https://www.kodeajaib.com/
https://www.kodeajaib.com/2016/05/vbnet-how-to-filter-datagridview-using.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