From Basic, it has accounted for most, and the use of VB starts to contact Win development also accounts for most, from VB to VB.NET, it is indeed a small, and many control arrays in .NET No, but the time is OK. This is used in my program. Today, this class is posted, this is very early from MSDN, according to what he said.
// ************************************************************** You can quote this class // Fan Weiwei // ***************************************** Namespace gradeSystem {
// ************************* // TEXTBOXARRAY implements dynamic increase and delete // textbox function // ***** ********************* Public Class TextBoxArray: System.Collections.collectionBase {Private Readonly System.Windows.Forms.form Hostform;
//Constructor
Public textBoxArray (System.Windows.Forms.form Host) {Hostform = Host;
}
// AddNewTextBox method Add a TextBox control public void addnewtextbox () {if (this.count <7) {
// Built a new TextBox instance. System.Windows.Forms.TextBox ATextBox = new system.windows.Forms.TextBox ();
// Add it to the intended internal list this.list.add (atextbox);
// Add TextBox to the collection list of the form referenced by the HostForm field. Hostform.Controls.Add (ATextBox);
// Set the initial attributes ATEXTBOX.LEFT = (count-1) * 130 70; optbox.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];}} // remove method to delete control public void Remove () {If (this.count> 0) {Hostform.Controls.remove (this [this.count -1]); this.list.removeat (this.count-1);}}}}