The majority of developers started from basic, and Windows developers started from VB. The changes from VB to VB.net are indeed not small, in the past, a lot of control arrays were used in. net, but the time is okay. This is one of my Program I used it. Today I pasted this class, which I saw from msdn a long time ago, according to what he said.
//*********************************
// Dynamically add and delete array controls
// Students who design the project can reference this class.
// Fan weixiao
//*********************************
Namespace gradesystem
{
//**************************
// Class textboxarray implements dynamic addition and Deletion
// Textbox Functions
//**************************
Public class textboxarray: system. Collections. collectionbase
{
Private readonly system. Windows. Forms. Form hostform;
//Constructor
Public textboxarray (system. Windows. Forms. form host)
{
Hostform = host;
}
// Add a Textbox Control Using the addnewtextbox Method
Public void addnewtextbox ()
{
If (this. Count <7)
{
// Create a new textbox instance.
System. Windows. Forms. textbox atextbox = new system. Windows. Forms. Textbox ();
// Add it to the internal list of the Set
This. List. Add (atextbox );
// Add textbox to the set list of the forms referenced by the hostform Field
Hostform. Controls. Add (atextbox );
// Set the initial attribute
Atextbox. Left = (count-1) * 130 + 70;
Atextbox. Top = 160;
Atextbox. width = 120;
Atextbox. borderstyle = system. Windows. Forms. borderstyle. fixedsingle;
Atextbox. font = new system. Drawing. Font ("verdana", 40, system. Drawing. fontstyle. Bold );
Atextbox. Tag = This. count;
// Initial Value
Atextbox. Text = "9.9 ";
Atextbox. forecolor = system. Drawing. color. Red;
}
}
// Create an index
Public System. Windows. Forms. textbox this [int Index]
{
Get
{
Return (system. Windows. Forms. textbox) This. list [Index];
}
}
// The remove method is used to delete controls.
Public void remove ()
{
If (this. Count> 0)
{
Hostform. Controls. Remove (this [This. Count-1]);
This. List. removeat (this. Count-1 );
}
}
}
}
Sorry, I used editplus to open the CS file, and then pasted it with Garbled text. this class may be used by my students during the design of the project. Some people will try it, so I can paste it here to copy it directly from here.