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. creating control array in runtime

creating control array in runtime

Scheduled Pinned Locked Moved C#
data-structureshelp
3 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.
  • L Offline
    L Offline
    liqnit
    wrote on last edited by
    #1

    hi im trying to create a number of radiobutton in runtime. int i = 0; while (TempString != null) { if (TempString.Length > 3) { RadioButton rbNew = new RadioButton (); rbNew.Name = (rbNew.Name.ToString() + i.ToString()); rbNew.Text = TempString; rbNew.Visible = true; pnVSSProjects.Controls.Add(rbNew); } i++; } but it only create the first RadioButton and not the others. please help. thanks Have a nice Day -- modified at 8:37 Wednesday 14th September, 2005

    D 1 Reply Last reply
    0
    • L liqnit

      hi im trying to create a number of radiobutton in runtime. int i = 0; while (TempString != null) { if (TempString.Length > 3) { RadioButton rbNew = new RadioButton (); rbNew.Name = (rbNew.Name.ToString() + i.ToString()); rbNew.Text = TempString; rbNew.Visible = true; pnVSSProjects.Controls.Add(rbNew); } i++; } but it only create the first RadioButton and not the others. please help. thanks Have a nice Day -- modified at 8:37 Wednesday 14th September, 2005

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      liqnit wrote: RadioButton rbNew = new RadioButton (); rbNew.Name = (rbNew.Name.ToString() + i.ToString()); rbNew.Text = TempString; rbNew.Visible = true; pnVSSProjects.Controls.Add(rbNew); You're not setting the Top and Left properties of the controls you're creating to move them around the container they're in. This means that each one is being put in the exact same place, so the first one created is the only one you actually see. All the others are behind it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      L 1 Reply Last reply
      0
      • D Dave Kreskowiak

        liqnit wrote: RadioButton rbNew = new RadioButton (); rbNew.Name = (rbNew.Name.ToString() + i.ToString()); rbNew.Text = TempString; rbNew.Visible = true; pnVSSProjects.Controls.Add(rbNew); You're not setting the Top and Left properties of the controls you're creating to move them around the container they're in. This means that each one is being put in the exact same place, so the first one created is the only one you actually see. All the others are behind it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        L Offline
        L Offline
        liqnit
        wrote on last edited by
        #3

        thanks it's working great now Have a nice Day

        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