1. Welcome to PHCorner Forums. Take a moment to Sign up and gain unlimited access and extra privileges that guests are not entitled to, such as:

    All that and more! Registration is quick, simple and absolutely free. Join our community today!

Visual Basic Help mga Sir sa magagaling sa VB.net

Discussion in 'Coding, Programming' started by jayjamil08, Mar 23, 2016.

  1. Paturo namn po codes ng search tapos e fifilter nya sa datagrid using VB.net (bindingSource) :(
  2. Search/Filter data grid view

    Dim someText As String = TextBox1.Text
    Dim gridRow As Integer = 0
    Dim gridColumn As Integer = 0
    Dim asd As String = 0
    For Each Row As DataGridViewRow In DGV1.Rows
    For Each column As DataGridViewColumn In DGV1.Columns
    Dim cell As DataGridViewCell = (DGV1.Rows(gridRow).Cells(gridColumn))
    If cell.Value.ToString.ToLower.Contains(someText.ToLower) Then
    cell.Style.BackColor = Color.Green
    asd = cell.RowIndex.ToString()
    End If
    gridColumn += 1
    Next column
    gridColumn = 0
    gridRow += 1
    Next Row
    MsgBox(asd + 1)
  3. Private Sub txt_search_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_search.TextChanged
    BindingSource1.Filter = String.Format("{0} LIKE '{1}%'", "user", txt_search.Text)

    BindingSource1.Sort = "user ASC"
    End Sub

    Private Sub txt_search_Validated(sender As System.Object, e As System.EventArgs) Handles txt_search.Validated
    If txt_search.Text = String.Empty Then
    BindingSource1.Filter = String.Format("{0} = '{1}'", "user", txt_search.Text)

    BindingSource1.Sort = "user ASC"
    End If
    End Sub
    jayjamil08 likes this.
  4. Salamat po sir
  5. sir??:rage::rage:..di kita bati
  6. MAAM panu po ung database access mo tapos esesearch mo sa data grid mag fifilter? salamat po sa sagot
    Last edited: Mar 23, 2016
  7. sorry maam :) baguhan lng po ako d2 :)
  8. avoid sms postings of message
Tags / Keywords: