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()

Recommended Answers

All 2 Replies

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.
`

thanks for answer..i'll try

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.