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. C#
  4. control arrays

control arrays

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiohelp
2 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.
  • P Offline
    P Offline
    Pyro Joe
    wrote on last edited by
    #1

    hi, I went to msdn and found some help, which told me to create the following lines of code: // Declare a new ButtonArray object. ButtonArray MyControlArray; MyControlArray = new ButtonArray(this); // Call the AddNewButton method of MyControlArray. MyControlArray.AddNewButton(); Well seeing how the "ButtonArray" thing doesn't exist, I can't really do anything with this. How do I go about creating control collections in visual studio 2005 (programatically with ability to create an indefinite number of controls and remove them)? I will actually be applying this when creating my own control, I simply am having trouble programatically creating instances of a control that I don't know how many of it I will need. Hilf mir! Thanks

    L 1 Reply Last reply
    0
    • P Pyro Joe

      hi, I went to msdn and found some help, which told me to create the following lines of code: // Declare a new ButtonArray object. ButtonArray MyControlArray; MyControlArray = new ButtonArray(this); // Call the AddNewButton method of MyControlArray. MyControlArray.AddNewButton(); Well seeing how the "ButtonArray" thing doesn't exist, I can't really do anything with this. How do I go about creating control collections in visual studio 2005 (programatically with ability to create an indefinite number of controls and remove them)? I will actually be applying this when creating my own control, I simply am having trouble programatically creating instances of a control that I don't know how many of it I will need. Hilf mir! Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You might do something like this: List<Button> buttons = new List<Button>(); buttons.Add(new Button(...)); ... To access the buttons you might do: foreach(Button b in buttons) { ... } or use any functions List<> provides :)

      Pyro Joe wrote:

      Hilf mir!

      Gerne! ;) regards

      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