Execution automatic sur vb

erokage Messages postés 91 Date d'inscription mardi 19 mai 2009 Statut Membre Dernière intervention 23 juin 2009 - 19 mai 2009 à 16:56
erokage Messages postés 91 Date d'inscription mardi 19 mai 2009 Statut Membre Dernière intervention 23 juin 2009 - 20 mai 2009 à 07:07
Je cherche comment faire pour que se petit bou de code s'exécute automatiquement sa clic ni rien sur vb


For x As Integer = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(x).Cells.Item(5).Value.ToString = "OUI" Then
DataGridView1.Rows(x).DefaultCellStyle.BackColor = Color.Red
End If
Next x

3 réponses

yassirguitare Messages postés 29 Date d'inscription mardi 20 décembre 2005 Statut Membre Dernière intervention 3 juin 2009
19 mai 2009 à 18:21
tu le met dans un événement load du formulaire
il s'exécutera une fois l'application chargé en mémoire

Programming is GOOOOOOOD
0
yassirguitare Messages postés 29 Date d'inscription mardi 20 décembre 2005 Statut Membre Dernière intervention 3 juin 2009
19 mai 2009 à 18:22
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
For x As Integer = 0 To DataGridView1.Rows.Count - 1

            If DataGridView1.Rows(x).Cells.Item(5).Value.ToString = "OUI" Then

                DataGridView1.Rows(x).DefaultCellStyle.BackColor = Color.Red

            End If

        Next x

    End Sub
Programming is GOOOOOOOD
0
erokage Messages postés 91 Date d'inscription mardi 19 mai 2009 Statut Membre Dernière intervention 23 juin 2009
20 mai 2009 à 07:07
Merci
0
Rejoignez-nous