none
Add row of controls when button is pressed

    Question

  • I want to make a program that may have just one input but it may have up to quite a few.

    Is there a way to make a, add line, button on the current form?

    Like every line has up to a drop-down menu, a checkbox and a text field

    With every button press I want a drop-down2, checkbox2 and textfield2 to be created.

    Monday, October 31, 2016 8:00 AM

All replies

  • Hi Athanatos154,

    1. Which language(programming language) are you using?
    2. Please provide a form including a drop-down menu, a checkbox and a text box,
      via cloud storage such as OneDrive or DropBox?
      or insert a screenshot of a form in your post?

    Regards,
    Ashidacchi
    Monday, October 31, 2016 10:45 AM
  • You can dynamically create controls, place them on the form, and then adding them to the Form control list, like this:

            'In the Load event of your Form
            Dim OneTB As TextBox
           
            OneTB = New TextBox
            OneTB.Size = New Drawing.Size(100, 20)
            OneTB.Location = New Point(100,100)
            OneTB.Name = "OneTB"
            OneTB.Text = OneTB.Name   
    'You can add a handler for your control to modify the behavior
            AddHandler OneTB.TextChanged, AddressOf OneTB_TextChanged
            'Now you add it to the Form Control
            Me.Controls.Add(OneTB )

    Have a look at this http://stackoverflow.com/questions/11312239/how-to-programmatically-add-controls-to-a-form-in-vb-net

    Monday, October 31, 2016 11:06 AM