1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
If DataGridView1.CurrentCellAddress.X.Equals(DataGridView1.Columns("EleveNom").Index) _
And DataGridView1.CurrentCell.Value IsNot DBNull.Value Then
FindValueInDataView(dst.Tables("TableSousJacente"), "EleveNom1", "Eleves_id", DataGridView1.CurrentCell.Value)
End If
End Sub
Private Sub FindValueInDataView(ByVal table As DataTable, ByVal colNameOuChercher As String, ByVal colNameOuTrouver As String, ByVal nom As String)
Dim dv = New DataView(table)
dv.Sort = colNameOuChercher
Dim index As Integer = dv.Find(nom)
If index = -1 Then
MsgBox("Item Not Found")
Else
MsgBox(dv(index)(colNameOuTrouver).ToString() & " " & dv(index)(colNameOuChercher).ToString())
End If
End Sub |