|
-
Nov 24th, 2000, 11:24 AM
#1
Thread Starter
Addicted Member
I have asked this a few times before, but i still dont get it..
Im using this to create a button at run time
Code:
Set Boton = Me.Controls.Add("VB.CommandButton", "Boton" & Index)
But, i dont create only one, i create several buttons, if i create one, just one, and use this
Code:
Private Sub Boton_Click()
Boton.Caption = "hi"
End Sub
It works fine, but when i create another button, and i want to use the first one, all the methods to that button cease to work. How can i make the methots to work on every button i create?
Thanks!
-
Nov 24th, 2000, 12:18 PM
#2
Hyperactive Member
One way I do this is to place a control on the form with index 0 (this can be invisible to start with if you don't need any).
Then when you need to add a new one use
load control.
where control is the name of the control to reproduce.
use unload to get rid of them
Hope this helps,
regards
Chtis
-
Nov 24th, 2000, 12:26 PM
#3
transcendental analytic
You can't create controlarrays at runtime, although you can create an array of controls, but to recieve the events of them you need to make wrapper classes for them. If you need to create a fixed amount of controls, you could also set to separate controls with withevents.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Nov 24th, 2000, 02:34 PM
#4
Thread Starter
Addicted Member
Thanks!!!
The load worked great!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|