search in 3 datagridview RRS feed

  • Question

  • I have 3 DatagridView and TextBox I want when setting the value by searching and selecting the search in 3 data 

    What is required to search for a specific value in the 3 Data Grid View? Provided they are in the same column? / And not under the condition that it be in the same row

    Sunday, November 12, 2017 11:46 PM


  • Hi ahmeddc,

    You want to search data from three datagridview control, if the value you want to search in the same column in three datagridview, you can only search from one column in datagridview, if the value may appear in any one column, you can search in the entire datagridview.

    Search from a column in datagridview.

     For i As Integer = 0 To DataGridView1.Rows.Count - 1
                    If DataGridView1.Rows(i).Cells("Column1").Value = TextBox1.Text Then
                        DataGridView1.Rows(i).Selected = True
                    End If

    Search from the entire datagridview

    For i As Integer = 0 To DataGridView1.RowCount - 1
                    For j As Integer = 0 To DataGridView1.ColumnCount - 1
                        DataGridView1.Rows(i).Cells(j).Value = TextBox1.Text
                        DataGridView1.Rows(i).Selected = True

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    • Marked as answer by ahmeddc Monday, November 13, 2017 4:24 AM
    Monday, November 13, 2017 2:57 AM