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. component array

component array

Scheduled Pinned Locked Moved Visual Basic
csharpdata-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.
  • D Offline
    D Offline
    Daniel Engelkes
    wrote on last edited by
    #1

    Is there a way that a component array can be created in vb.net like in vb6? For example if I need to create a button Array? Any examples? I am looking to shorten the code below.

         Menuitem1.Text = item(0).menuitem
            MenuItem2.Text = item(1).menuitem
            MenuItem3.Text = item(2).menuitem
            MenuItem4.Text = item(3).menuitem
            MenuItem5.Text = item(4).menuitem
            MenuItem6.Text = item(5).menuitem
            MenuItem7.Text = item(6).menuitem
            MenuItem8.Text = item(7).menuitem
            MenuItem9.Text = item(8).menuitem
            MenuItem10.Text = item(9).menuitem
            MenuItem11.Text = item(10).menuitem
    
    W L 2 Replies Last reply
    0
    • D Daniel Engelkes

      Is there a way that a component array can be created in vb.net like in vb6? For example if I need to create a button Array? Any examples? I am looking to shorten the code below.

           Menuitem1.Text = item(0).menuitem
              MenuItem2.Text = item(1).menuitem
              MenuItem3.Text = item(2).menuitem
              MenuItem4.Text = item(3).menuitem
              MenuItem5.Text = item(4).menuitem
              MenuItem6.Text = item(5).menuitem
              MenuItem7.Text = item(6).menuitem
              MenuItem8.Text = item(7).menuitem
              MenuItem9.Text = item(8).menuitem
              MenuItem10.Text = item(9).menuitem
              MenuItem11.Text = item(10).menuitem
      
      W Offline
      W Offline
      Wayne Gaylard
      wrote on last edited by
      #2

      You can either create a List(Of TextBox) and put your controls in the list, or you can put your MenuItem TextBoxes in a separate panel and iterate through the controls on the panel.

      1 Reply Last reply
      0
      • D Daniel Engelkes

        Is there a way that a component array can be created in vb.net like in vb6? For example if I need to create a button Array? Any examples? I am looking to shorten the code below.

             Menuitem1.Text = item(0).menuitem
                MenuItem2.Text = item(1).menuitem
                MenuItem3.Text = item(2).menuitem
                MenuItem4.Text = item(3).menuitem
                MenuItem5.Text = item(4).menuitem
                MenuItem6.Text = item(5).menuitem
                MenuItem7.Text = item(6).menuitem
                MenuItem8.Text = item(7).menuitem
                MenuItem9.Text = item(8).menuitem
                MenuItem10.Text = item(9).menuitem
                MenuItem11.Text = item(10).menuitem
        
        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You can Create a Array of Component. Bydefault it is not possible.but You can use a function to create no. of Components to create. The main thing is that you should dispose every component. Else it will be generate error.

        If you can think then I Can.

        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