|
-
Jun 20th, 2000, 04:09 AM
#1
If you want to add a CommandButton, at runtime, use this code.
Code:
Private Sub Command1_Click()
Controls.Add "VB.CommandButton", "Command1"
Me!Command1.Move 0, 0
Me!Command1.Caption = "My Button"
Me!Command1.Visible = True
End Sub
-
Jun 20th, 2000, 04:17 AM
#2
Monday Morning Lunatic
clever, meg - much better than mine! 
pause while I file it away for future reference...
-
Jun 20th, 2000, 04:45 AM
#3
Keep in mind, this only works in VB6. If you do not have VB6, you can always load them from a Control Array, so you need at least 1 instance of it on the Form and make sure that the Index is set to 0.
Code:
Private Sub cmdButton_Click()
Load Comand1(1)
Command1(1).Move 0, 0
Command1(1).Caption = "My Button"
Command1(1).Visible = True
End Sub
-
Jun 20th, 2000, 04:50 AM
#4
New Member
Thanxs All
thanxs all for the replay, now i can go 2 sleep......at last
-
Jun 20th, 2000, 04:54 AM
#5
Monday Morning Lunatic
why - what's your time there?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 20th, 2000, 04:58 AM
#6
It's pretty confusing when you have so many people in so many different time zones.
-
Jun 20th, 2000, 05:04 AM
#7
Monday Morning Lunatic
yeah, it gets tricky after a while, but if you get your TZ settings on your profile right, it's not so bad. however, when my outlook inbox says that I received the notification at 3 in the morning I get confused then when the thread says it was a different time!
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 20th, 2000, 05:43 AM
#8
Addicted Member
Thats right guys, the same thing in here too
-
Jun 20th, 2000, 07:37 AM
#9
Lively Member
Hmmm. pretty good you guys but I dont know what kind of program you want but if you want a button to appear when some one else clicks another button (or does anything else) then
Private Sub Form_load()
Command1.visible=false
end sub
Private Sub Command2_click()
Command2.visible = true
end sub
THATS THE CHEAP WAY TO DO IT BUT IT TAKES LESS CODE!
IF YOU CAN'T DO IT, FIND A WAY AROUND IT!
-
Jun 20th, 2000, 10:29 PM
#10
But that way, you have already created it. In my method above, you create it from scratch.
-
Jun 21st, 2000, 11:54 PM
#11
Monday Morning Lunatic
er...nitrolic2...if you make command2 visible when you click on it you can't click on it - invisible objects don't receive events.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|