Results 1 to 3 of 3

Thread: Assigning Controls to an Array with arbitrary Index

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2003
    Location
    India
    Posts
    30

    Assigning Controls to an Array with arbitrary Index

    Hi All

    I have got the idea that the Control Arrays no longer exist in VB.Net. I can use an Array of Controls to simulate it though. My application in VB has a lot of textboxes on the Forms.

    Further, these Forms are divided into some pre-defined section. Loosely based on the Sections, I gave an index to the Textbox...e.g. the numbering of textboxes in Section 1 would start as 1001, 1002...and so on. Similarly in Section 2, the textboxes would be numbered like 2001, 2002 etc.

    I was using this Indexing for various purposes like applying validation to all similar kinds of Textboxes. Is there any way I can assign the controls to the array on similar indices and use it the way I was doing earlier.

    Using the Name or the tag property to contain the Index would not be a good idea. I have around 700 to 800 controls and iterating through the entire collection of controls to arrive upon the required textbox might be expensive.

    Thanx
    Isha
    Last edited by ishaaseja; Jan 6th, 2004 at 02:19 AM.

  2. #2
    Hyperactive Member sw_is_great's Avatar
    Join Date
    Nov 2003
    Posts
    330
    control array is not there in vb .net but u can create an array of txtboxes orwhatever at runtime and then u can loop through those....
    Regards

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2003
    Location
    India
    Posts
    30
    But I want to assign specific indices to these Controls in the Array.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width