NCSA SCADA
asked on
vb.net dynamically add, name, place and resize text boxes to a windows form
Hi Experts - I am trying to create a form that will add texboxes to a form. Just to figure it out, I have created a simple form with one button and one text box. User enters a number in the text box and it shoud create that number of textboxes. I don't know if I am going about this the wrong way, but here is what I have so far - Also is there a way to dictate the size and position -(by the way, I am a newbie)
Thanks
Thanks
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim I As Integer
MsgBox(txtNumber.Text)
For I = 1 To txtNumber.Text
Dim myTextBox = New TextBox
myTextBox.Name = "txtDynamic" & I
myTextBox.Text = "Control Number:" & I
Me.Controls.Add(myTextBox)
Next
End Sub
ASKER
Thanks for the quick response -
I must be missing somthing - I tried this
myTextBox.Size = New Size(10, 10)
myTextBox.Location.X = "485"
myTextBox.Location.Y = "339"
I get this error - "Expression is a value and therefore cannot be the target of an assignment
I must be missing somthing - I tried this
myTextBox.Size = New Size(10, 10)
myTextBox.Location.X = "485"
myTextBox.Location.Y = "339"
I get this error - "Expression is a value and therefore cannot be the target of an assignment
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked perfect - thanks for the additional info as well - cleared it right up
myTextBox.Location.X =
myTextBox.Location.Y =