Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

[ TUVGM ] - Comment reconnaitre un contrôle qui possède un index ?

3 réponses
Avatar
The Ultimate Video Game Museum
Tout est dans la question ... ^_^

Comment reconnaitre un contrôle qui possède un index ?

J'ai essayé de faire ça avec la ligne "If Control_Cible.Index" met ça génère
une erreur lorsque le contrôle ciblé ne possède pas d'index car je suppose
que la propriété n'existe pas.

For Each Control_Cible In Feuille.Controls

If Control_Cible.Index <> Null Then ...

[...]

Next Control_Cible

Merci d'avance pour l'aide apportée car là je suis complètement bloqué.

Cordialement,

Topper

Webmastering, webdesign des sites :
The Ultimate Video Game Museum : http://www.TUVGM.com/
TUVGM Live Playing ! : http://www.TUVGM.com/liveplaying/
FreeDO France : http://www.TUVGM.com/freedo/

3 réponses

Avatar
fredg
> Comment reconnaitre un contrôle qui possède un index ?


salut,
voici une solution.

Private Sub Command4_Click()
Dim CC As Object

On Error GoTo Command4_Click_Error

For Each CC In Me.Controls
Debug.Print CC.Name & " " & CC.Index
Next

On Error GoTo 0
Exit Sub

Command4_Click_Error:
If Not Err.Number = 343 Then
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Command4_Click of Feuille Form1"
End If
End Sub

Fred
Avatar
The Ultimate Video Game Museum
J'ai modifié mon programme pour ne plus avoir cette erreur.
Je garde ça de coté au cas où je retombe dessus.

Merci pour la réponse.

Cordialement,

Topper

Webmastering, webdesign des sites :
The Ultimate Video Game Museum : http://www.TUVGM.com/
TUVGM Live Playing ! : http://www.TUVGM.com/liveplaying/
FreeDO France : http://www.TUVGM.com/freedo/


"fredg" a écrit dans le message de
news:
> Comment reconnaitre un contrôle qui possède un index ?
salut,
voici une solution.

Private Sub Command4_Click()
Dim CC As Object

On Error GoTo Command4_Click_Error

For Each CC In Me.Controls
Debug.Print CC.Name & " " & CC.Index
Next

On Error GoTo 0
Exit Sub

Command4_Click_Error:
If Not Err.Number = 343 Then
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in


procedure
Command4_Click of Feuille Form1"
End If
End Sub

Fred




Avatar
The Ultimate Video Game Museum
OK !!! ^_^


Topper

Webmastering, webdesign des sites :
The Ultimate Video Game Museum : http://www.TUVGM.com/
TUVGM Live Playing ! : http://www.TUVGM.com/liveplaying/
FreeDO France : http://www.TUVGM.com/freedo/


"fredg" a écrit dans le message de
news:
petite rectif...
dans la gestion d'exeption, il faut placer un resume next pour l'erreur


343,
sinon tout s'arrete..
Fred
"The Ultimate Video Game Museum" wrote in message
news:3f675bd9$0$20158$
> J'ai modifié mon programme pour ne plus avoir cette erreur.
> Je garde ça de coté au cas où je retombe dessus.
>
> Merci pour la réponse.
>
> Cordialement,
>
> Topper
>
> Webmastering, webdesign des sites :
> The Ultimate Video Game Museum : http://www.TUVGM.com/
> TUVGM Live Playing ! : http://www.TUVGM.com/liveplaying/
> FreeDO France : http://www.TUVGM.com/freedo/
>
>
> "fredg" a écrit dans le message de
> news:
> > > Comment reconnaitre un contrôle qui possède un index ?
> > salut,
> > voici une solution.
> >
> > Private Sub Command4_Click()
> > Dim CC As Object
> >
> > On Error GoTo Command4_Click_Error
> >
> > For Each CC In Me.Controls
> > Debug.Print CC.Name & " " & CC.Index
> > Next
> >
> > On Error GoTo 0
> > Exit Sub
> >
> > Command4_Click_Error:
> > If Not Err.Number = 343 Then
> > MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
> procedure
> > Command4_Click of Feuille Form1"
> > End If
> > End Sub
> >
> > Fred
> >
> >
>
>