0

hy im very newbie with VB.net 2010

i want to search/filter my datagridview with textbox

i use this to connect mysql and datagridview

dbconn = New MySqlConnection("server=localhost ;database=login")
        Try
            dbconn.Open()
        Catch ex As Exception
            MsgBox("Connection Error")
            Close()
        End Try

Dim table As New DataTable()
        dbdata = New MySqlDataAdapter("SELECT * FROM pengguna", dbconn)
        dbdata.Fill(table)
        DGV.DataSource = table
        DGV.Refresh()
2
Contributors
2
Replies
14
Views
3 Years
Discussion Span
Last Post by pebryan
0

Assuming you would want your grid to display the pengguna of which you entered the name in some textbox, you could use the following routine (you would call the sub as setGridToPengguna(nameTextbox.text)

Private Sub setGridToPengguna(name As String)
        Dim rowIndex As Integer = 0
        For Each r As DataGridViewRow In dgv.Rows
            If r.Cells("name").Value = name Then
                dgv.CurrentCell = r.Cells("name")
                Exit For
            End If
        Next
    End Sub

Let us know if that helps and good luck.
`

Edited by PerplexedB

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.