Click to See Complete Forum and Search --> : Create Buttons on RunTime(Not Design Time)


gema_chris
September 9th, 2001, 01:57 AM
Could it be possible to create buttons at runtime and not in design time? and also please explain the uses of commands being used ...
i will appreciate it very much ....thanks

urs
September 9th, 2001, 02:52 AM
Dim cmd As CommandButton
Set cmd = Controls.Add("vb.commandbutton", "Name")
cmd.Visible = True

Then u can set its left and right as u want
Best of luck

SAKYA
September 9th, 2001, 04:14 AM
take a command button command1 at design time and set it's index property to 0.this will create a control array with the first item as command1(0).set it's visible property to false.now type this code in the event procedure.


load command1(1)
command1(1).visible=true
command1(1).left=1000
command1(1).top=1000




if you want to create more than one command buttons then use this code


static i as integer
i=i+1
load command1(i)
command1(i).visible=true
command1(i).left=1000
command1(i).top=1000



hope it helps you.

Cimperiali
September 10th, 2001, 02:24 AM
Have also a look here:
http://codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vb&Number=53553&page=&view=&sb=

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater