Détruire un contrôle en vb

cynbbq Messages postés 6 Date d'inscription vendredi 31 octobre 2003 Statut Membre Dernière intervention 23 novembre 2003 - 11 nov. 2003 à 23:41
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 - 12 nov. 2003 à 00:09
j'aimerais savoir ce qu'il y a d'anormal dans mon code pour enlever tous les pictures box qui n'ont pas les noms que j'ai inscrit.

'Dim mycontrol As Control

For Each mycontrol In Me.Controls.Count
If TypeOf mycontrol Is VB.PictureBox Then
If mycontrol.Name <> "pctHautCentre" And _
mycontrol.Name <> "pctHautDroit" And _
mycontrol.Name <> "pctBasGauche" And _
mycontrol.Name <> "pctBasCentre" And _
mycontrol.Name <> "pctBasDroit" Then
Set mycontrol = Nothing
End If
End If
Next mycontrol

1 réponse

Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
12 nov. 2003 à 00:09
Le code de ton énumeration n'est pas tout a fait correct :

Dim mycontrol As Control

For Each mycontrol In Me.Controls
If TypeOf mycontrol Is VB.PictureBox Then
If mycontrol.Name <> "pctHautCentre" And _
mycontrol.Name <> "pctHautDroit" And _
mycontrol.Name <> "pctBasGauche" And _
mycontrol.Name <> "pctBasCentre" And _
mycontrol.Name <> "pctBasDroit" Then
Set mycontrol = Nothing
End If
End If
Next mycontrol 


By Renfield

[mailto:thomas_reynald@msn.com thomas_reynald@msn.com]

Aucune touche n'a ete blessee lors de la saisie de ce texte.......... ;)
0
Rejoignez-nous