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. How to change a control into an array?

How to change a control into an array?

Scheduled Pinned Locked Moved Visual Basic
csharpvisual-studiodata-structurestutorialquestion
3 Posts 3 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.
  • R Offline
    R Offline
    rushing
    wrote on last edited by
    #1

    Here is a control on a winform. I want to create an array of this control. In vb 6.0 , we just copy and paste the control, the compiler will create array of control automautically. However, we could not do so in vs.net. Maybe friends will teach me. Thanks!

    D M 2 Replies Last reply
    0
    • R rushing

      Here is a control on a winform. I want to create an array of this control. In vb 6.0 , we just copy and paste the control, the compiler will create array of control automautically. However, we could not do so in vs.net. Maybe friends will teach me. Thanks!

      D Offline
      D Offline
      Daniel1324
      wrote on last edited by
      #2

      ' For array of text boxes Dim txtBoxArray as TextBox() Dim x as Integer For Each ctl As Control In Me.Controls If TypeOf ctl Is TextBox Then ReDim Preserve txtBoxArray(x) txtBoxArray(x) = ctl x += 1 EndIf Next You can access them like txtBoxArray(0), txtBoxArray(1), ect...

      1 Reply Last reply
      0
      • R rushing

        Here is a control on a winform. I want to create an array of this control. In vb 6.0 , we just copy and paste the control, the compiler will create array of control automautically. However, we could not do so in vs.net. Maybe friends will teach me. Thanks!

        M Offline
        M Offline
        Mohamad Al Husseiny
        wrote on last edited by
        #3

        Do array of controls in your code Contols like any object in .net so you can create control of TextBoxs for example Dim textBoxs(5) As TextBox and access each control via index MCAD

        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