How to add textboxes, labels and buttons dynamically at runtime in VB?

后端 未结 5 1527
滥情空心
滥情空心 2021-01-06 19:25

How to create a form with a button add_subjects which adds one textbox and a corresponding label on each click,3 buttons - Add, Edit and Dele

5条回答
  •  我在风中等你
    2021-01-06 19:37

    You can use the same code as above and, in the end, use the parent property of control. Because the control (TextBox, Buttom, etc.) is "inside" of a "container" (form, groupbox, etc.). Like this...

      ...
      Dim textbox1 As New TextBox
      textbox1.Name = "Textbox1" 'or other
      ...
      textbox1.parent = Me 'Me = the form
      ...
    

提交回复
热议问题