Results 1 to 3 of 3

Thread: Control Arrays

  1. #1

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    Does anyone know a way to overcome the missing control array feature in vb.net?
    I know I can create controls at runtime, but I need them declared withevents and share the same event handlers. I could share the same event handlers, but the problem is that the number of controls to be loaded is not known at design time (could be loaded from a database or something).

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898
    THe only way I can think to overcome this is to introduce a counter value and make the counter value part of the control name.

  3. #3

    Thread Starter
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    The problem is that you can't 'Dim WithEvents' if you don't have a name for the variable, so loading a variable number of controls is only possible if you don't need the events. The only way I can think of is to declare a maximum number of object variables at design time, and load them when you need them. However, this will limit the number of controls you can use, and will make the code look bulky. It is possible to share an event handler, but again, you have to know the names of the variables at design time.

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