OVH Cloud OVH Cloud

mettre à zéro des contrôles

1 réponse
Avatar
boblebob
bjr,

dans un userform j'ai plein de contrôle Combobox, Textbox...
voici la méthode que j'utilise pour les réinitialiser

With UserForm1
.TbNom.Value = ""
.TbAdu.Value = ""
.TbEnf.Value = ""
.CboConnu = ""
...
end with


N'y a-t-il pas plus rapide ?

merci
--

a+
nosp-00-boblebob@voila.fr
(enlever nosp-00-)

1 réponse

Avatar
Pascal Engelmajer
Salut,
Dim ctrl As Control
Dim nom As String
For Each ctrl In Me.Controls
nom = ctrl.Name
If InStr(nom, "TextBox") Then 'ou tout autre test particulier
ctrl.Value = ""
ElseIf InStr(nom, "CheckBox") Then 'ou tout autre test particulier
ctrl.Value = False
ElseIf InStr(nom, "ComboBox") Then 'ou tout autre test particulier
Debug.Print ctrl.ListIndex
ctrl.ListIndex = -1
'etc
End If
Next ctrl
--
Amicalement.
Pascal
"il n'y a pas de vent favorable pour celui qui ne sait pas ou il va."
Sénèque.
http://www.ilyapa.net/excel
http://www.ilyapa.net/baseExcel
"boblebob" a écrit dans le message de news:

bjr,

dans un userform j'ai plein de contrôle Combobox, Textbox...
voici la méthode que j'utilise pour les réinitialiser

With UserForm1
.TbNom.Value = ""
.TbAdu.Value = ""
.TbEnf.Value = ""
.CboConnu = ""
...
end with


N'y a-t-il pas plus rapide ?

merci
--

a+

(enlever nosp-00-)