how to generate group boxes and buttons dynamically?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stephen04
    New Member
    • Jul 2010
    • 19

    #1

    how to generate group boxes and buttons dynamically?

    hi
    i need learn how to generate buttons and group boxes dynamically.my scenario is from the settings the user has to select the amount of group boxes he wants then in every group box he has to select the amount of buttons he wants. how can i make this happen?

    thanx
    stephen
  • Joseph Martell
    Recognized Expert New Member
    • Jan 2010
    • 198

    #2
    What are you stuck on? Do you not know what code it takes to create the group boxes and buttons, do you not know how to get the information from the user, or something else?

    Comment

    • stephen04
      New Member
      • Jul 2010
      • 19

      #3
      exactly I'm stuck on both of them and I've been banging my head on this for a wile but i cant figure how it has to be done

      Comment

      • truezplaya
        New Member
        • Jul 2007
        • 115

        #4
        Create a drop down with some numbers in or even use the numeric up down control

        Once they have selected a number either fire a selected index changed event or an on click event.

        Something along these lines

        Code:
        //Convert the text from the drop down to an int
        //do a for loop
        Button objButton = new Button();
        objButton.Name = //for loop integer here
        // Set other button properties here
        // Add the button to the appropriate group box
        groupBoxName.Controls.Add(objButton);
        This isn't a full working piece of code but it's not far off, Just have a tinker with it, Start off by doing it to one group box with a set amount of buttons. Then build from there.

        Comment

        Working...