[vb] integrer variable

Bonjour,
newbie dans vb 2005 ;-)
comment je peux integrer une variable dans un nom d'un controle?
ex:
i = "6"
Label(i).Text = "test"

je ne trouve pas le syntax!

merci pour votre aide

thomas
thomas@dresch.fr
Configuration: Windows XP
Firefox 2.0.0.6
VB 2005 express

2 réponses

  1. Do you know the same code for VB.net (not 2005) ??
    I have same problems and I get errors
    1. Bonjour,

      Il existe plus d'une méthode :

      En voilà une, et peut-être pas la meilleur !

      Private Sub IdentifieEtiquette()
      
          Dim i As Integer, NomCtr As String
          Dim objNom As Object
          
          For i = 1 To 3
              NomCtr = ("Label" & i)
              Set objNom = Controls(NomCtr)
              objNom.Caption = ("Text" & i)
          Next i
      
      End Sub
      '
      


      Lupin
      1. Salut Lupin,
        c'est genial ;-)
        merci
        Tom