I'm using this code:
But it always shows the first match in //dwIDCode:Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim matchRowdwID = (From dgvRow In DataGridView1.Rows Let r = DirectCast(dgvRow, DataGridViewRow) Where Not (r.IsNewRow AndAlso r.Cells("szName").Value.ToString = TextBox1.Text) Select r.Cells("//dwID").Value).ToArray If matchRowdwID.Count > 0 Then MsgBox(matchRowdwID.First.ToString) End Sub




Reply With Quote