Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add Controls at runtime
Message
De
22/04/2003 11:02:35
 
 
À
22/04/2003 10:49:56
Alvin Lourdes
Children and Youth Services Cluster
Toronto, Ontario, Canada
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00780136
Message ID:
00780142
Vues:
13
This message has been marked as the solution to the initial question of the thread.
You can use code like this:
Dim WithEvents cmdObject As CommandButton

Private Sub Form_Load()

  Set cmdObject = Me.Controls.Add("VB.CommandButton", "cmdOne")
  cmdObject.Left = 200
  cmdObject.Top = 200
  cmdObject.Visible = True
End Sub

Private Sub cmdObject_Click()

  MsgBox "Dynamic button was clicked!"
End Sub
If you do not need to handle events of the dynamically added control, simply remove "WithEvents" keyword from its declaration.

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform