Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. create multiple textbox using for loop in vb.net???

create multiple textbox using for loop in vb.net???

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    charleslau2855
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • C 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You have not set a position for the textbox.  It probably exists, but not in the visible area of the form.

      C 1 Reply Last reply
      0
      • C Christian Graus

        You have not set a position for the textbox.  It probably exists, but not in the visible area of the form.

        C Offline
        C Offline
        charleslau2855
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • C 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

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          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 ?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups