How can I add collection of control like VB6?

Hi all,

I want to know how can i have the collection of controls in .NET like VB6 does  I mean I want to have 4 textboxes with the same name, using index TextBox1(1->4), how can I do that

Thanks alot


Answer this question

How can I add collection of control like VB6?

  • S76

    i think you need to lookup on <b>Array</b> topic.  TextBox[i] isn't the name of the control, it merely accesses the ith (0 based index) of the TextBox collection.  A more appropriate variable could be:

    TextBox[] TextBoxArray;
    TextBoxArray[i] is the ith TextBox on the array of textboxes

  • amitdk

    you can have an array of textboxes:

    TextBox[] TextBox1 = new TextBox[4]


  • jchaffeejr

    Check the controlarray:

    http://windowsforms.net/ControlGallery/ControlDetail.aspx Control=251&tabindex=9

  • Catalin Pop Sever

    Did you meant i can do that in design time  Just simple change the name of text box to something like TextBox[i]
  • How can I add collection of control like VB6?