me.controls

  • Thread starter Thread starter craig
  • Start date Start date
C

craig

me.fraDate.Top = Me.Controls("fra" & Me.cboDate.Text).Top

The top line is from vb6 how can I do the same thing in
vb.net?

fraDate is a panal
me.cbodate is a combo box with a value of 1 - 6 in it.
I also have 6 panals named fra1, fra2, fra3, etc.

Thanks for the help!
 
* "craig said:
me.fraDate.Top = Me.Controls("fra" & Me.cboDate.Text).Top

The top line is from vb6 how can I do the same thing in
vb.net?

Add all controls to a hashtable ('Hashtable'), the name as key and the
value is the reference to the control.
 
* "craig said:
come on there must be a way to refer to it directly as in
vb6.

No, there is no direct way to refer to the controly by their name.
 
ok, so I dim a 2 dimential array? The first column being
the number (1-6) and the second column being the name of
the corresponding panal?

What do I dim the arrary as a string? How do I use the
array in a statment latter on in the program?

Thanks for the help!
 
Hi,

Kind of an aside, but a keyed Controls collection will be in the next
version of Windows Forms.

Ian
 
Back
Top