Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run time control creation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can I create up to 50 command buttons(depending on the number typed in a text box) in rows of 10, using a control array? I tried several ways, and I can only do the first ten, while the others are not well aligned. Can someone please help me with this?
 
You should align them yourself using the .top and .left properties. You can do this by nesting two for-next loops, one counting from 1 to 5 and the other from 1 to 10. Then using the loop counter vars (like intRow and intCol) to set the .top and .left properties. Is this what you want? [sig]<p>Mohammad Mehran Nikoo<br><a href=mailto:mohmehran@yahoo.com>mohmehran@yahoo.com</a><br>MCP with experience in VB, ASP, XML, SQL, COM[/sig]
 
Hi, this could be what you need
Firstly be sure you have a command button in the design time with any name(i took it as cmdnew) but its index should be 0.

for i = 1 to n-1
load cmdnew(i)
if (i mod 9 > 0) then
cmdnew(i).top = cmdnew(i-1).top
cmdnew(i).left = cmdnew(i-1).left + cmdnew(i-1).width
elseif (i mod 9 = 0) then
cmdnew(i).top = cmdnew(0).top + cmdnew(0).height
cmdnew(i).left = cmdnew(0).left
end if
next

This should solve your problem or atleast give you some idea. will you please keep me informed if this works. Please mail to gantibabu@yahoo.com. all the best...vijay
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top