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!

How to dynamically create a label box after run time 4

Status
Not open for further replies.

ulchm

Programmer
May 22, 2007
23
CA
Hey guys, one of the clerks at work here just e-mailed me something that really boggled my mind. Asides from going web-based (not an option) I don't know how to do this.

They basically want to be able to add an object (went with label because that's basically what it is) after run time and be able to move that and position it within the bounds of panel.

This is as far as I got with it then I started scratching my head

Dim intWidth As Integer, intHeight As Integer
Dim Box1 As System.Windows.Forms.Label

intWidth = txtWidth.Text.ToString()
intHeight = txtHeight.Text.ToString()

Box1 = New System.Windows.Forms.Label
Box1.BackColor = System.Drawing.Color.Yellow
Box1.Size = New System.Drawing.Size(intWidth, intHeight)
Box1.Location = New System.Drawing.Point(216, 88)
Box1.Text = txtID.Text.ToString()




The above code executes but nothing happens, Im' sure I'm just missing something small, the next obstacle however is to allow them to move the label around, and create more then 1 (up to 50+)

Let me know any ideas you might have.
 
NICE! works like a charm and a VERY BIG THANK YOU to everyone who contributed on this post, you made a clerk very happy! And saved me having to think, also an added bonus!

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top