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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create buttons programetically and place them neatly

Status
Not open for further replies.

Addpure

MIS
Jul 3, 2007
6
US
Is there a way I can create few buttons (of same size and) place them on form prorametically?
 
Yes. What have you tried so far?

[small]----signature below----[/small]
With all due respect, Don Bot, I don't think we should rely on an accident happening. Let's kill him ourselves.

Ignorance of certain subjects is a great part of wisdom
 
I have created buttons old fashioned way(dragging from toolbox and placing them manually).
 
Declare a button, set it up how you want it, then add it to a GUI object's control collection. Then set it's location. The location will be based off of the location of the GUI object you are placing it on.

Code:
dim button1 as new button
button1.width = 200
button1.height = 100
button1.text = "weee!"
me.controls.add (button1)
button1.top = 100
button1.left = 100

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top