1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Public Sub MyDataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MyDataGridView.CellClick
Dim ligne As Integer = Datagrid1.CurrentCell.RowIndex
'Par exemple si on sélectionne la ligne 1
If ligne = 1 Then
PictureBox.Image = My.Ressources.Mypict1
'Ou si on sélectionne la ligne 5 ou 6
ElseIf ligne = 5 or ligne = 6 then
PictureBox.Image = My.Ressources.Mypict2
'Ou si on sélectionne n'importe quelle autre ligne
Else
PictureBox.Image = My.Ressources.Mypict3
End If
End Sub |