Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding Controls At Runtime
Message
De
17/04/2002 06:06:32
 
Information générale
Forum:
Visual Basic
Catégorie:
Contrôles ActiveX
Divers
Thread ID:
00645508
Message ID:
00645817
Vues:
31
This message has been marked as a message which has helped to the initial question of the thread.
OK, i had good sleep and dream solution for your problem (but also have two bad news for you) :-)

Fist bad news: you must change again technique...

Append one CommandButton (ctlNewButton) to UserControl and set its properties (Left, Top, Width, Height) to appropriate values. Set Index property to 0 and Visible property to False. In code issue:

'At module level (in (General)/(Declarations) section)
Dim I as Integer

'In Sub AddButton
I = I + 1
Load ctlNewButton(I)
ctlNewButton(I).Top = ctlNewButton(I).Top + 30 'Pixels
ctlNewButton(I).Visible = True

Click on every button will raise click event of ctlNewButton, where you will got Index of clicked button.

Second bad news: Index (I in your case) is Integer and cannot be negative. I.e. you can load max. 32767 buttons... (Index 0 is reserved for your invisible button, but if you wanna, in the first call of AddButton you can set Visible of ctlNewButton(0) to True instead of loading new button and incrementing I).

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