create multiple textbox using for loop in vb.net???
-
hi, anyone know how to create multiple textbox using for loop in vb.net? Dim i As Integer For i = 0 To i <= 10 Dim textBox(i) As TextBox textBox(i).Multiline = True textBox(i).ScrollBars = ScrollBars.Vertical textBox(i).AcceptsReturn = True textBox(i).AcceptsTab = True textBox(i).WordWrap = True textBox(i).Text = "Welcome!" textBox(i).Visible = True Me.Controls.Add(textBox(i)) Next I have write the above coding but it's look not successfully and didn't appear any textbox comeout!!! So, anyone know please help! charleslau2855
-
hi, anyone know how to create multiple textbox using for loop in vb.net? Dim i As Integer For i = 0 To i <= 10 Dim textBox(i) As TextBox textBox(i).Multiline = True textBox(i).ScrollBars = ScrollBars.Vertical textBox(i).AcceptsReturn = True textBox(i).AcceptsTab = True textBox(i).WordWrap = True textBox(i).Text = "Welcome!" textBox(i).Visible = True Me.Controls.Add(textBox(i)) Next I have write the above coding but it's look not successfully and didn't appear any textbox comeout!!! So, anyone know please help! charleslau2855
You have not set a position for the textbox. It probably exists, but not in the visible area of the form.
-
You have not set a position for the textbox. It probably exists, but not in the visible area of the form.
Thanks, Christian Graus! the following code: Dim i As Integer For i = 0 To i <= 10 Dim textBox(i) As TextBox dim e as integer textBox(i).Multiline = True textBox(i).ScrollBars = ScrollBars.Vertical textBox(i).AcceptsReturn = True textBox(i).AcceptsTab = True textBox(i).WordWrap = True textBox(i).Text = "Welcome!" textBox(i).Visible = True textBox(i).Location = New Point(16 + e, 32) Me.Controls.Add(textBox(i)) i = i + 1 e = e + 5 Next Note: but after i set the position but It's also didn't comeout the textbox? then how to get the textbox comeout? charleslau2855
-
Thanks, Christian Graus! the following code: Dim i As Integer For i = 0 To i <= 10 Dim textBox(i) As TextBox dim e as integer textBox(i).Multiline = True textBox(i).ScrollBars = ScrollBars.Vertical textBox(i).AcceptsReturn = True textBox(i).AcceptsTab = True textBox(i).WordWrap = True textBox(i).Text = "Welcome!" textBox(i).Visible = True textBox(i).Location = New Point(16 + e, 32) Me.Controls.Add(textBox(i)) i = i + 1 e = e + 5 Next Note: but after i set the position but It's also didn't comeout the textbox? then how to get the textbox comeout? charleslau2855
charleslau2855 wrote:
i = i + 1
Doesn't think mean that i is increased twice per loop ? Have you tried stepping through and checking things like the Size and Location property after it's added to the controls collection ?