简体   繁体   中英

VS 2010 VB.net create listbox as class

I have a Form1 in this Form1 I have created basic Common Controls like a listbox, a Combobox etc.

What I would like to do is to create a Button Click event that will create a new set of all these "Common Controls" like a new Class item, so that they are created below the first set.


Before Button(Add new) is pressed

"Combobox1" "ListBox1" "Textbox1"
Button(Delete this Item)


After Button(Add new) is pressed 2 times in row:

Button(Add new)

"Combobox1" "ListBox1" "Textbox1"
Button(Delete this Item)

"Combobox2" "ListBox2" "Textbox2"
Button(Delete this Item)

"Combobox3" "ListBox3" "Textbox3"
Button(Delete this Item)

Any hints on how to do this?

I will presume you are looking to learn vb.net, Here is a good article to start with

http://www.tutorialspoint.com/vb.net/vb.net_listbox.htm

the code for an event triggered by a button click is

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  MsgBox("You have clicked a button")
End Sub

您必须创建一个全新的类来生成文档(如果我没记错的话,可以是流作家),然后将所有内容记录在字符串中,确保有循环,提供输入位置,以便您实际上可以为每个控件提供一个ID。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM