Home All Groups Group Topic Archive Search About
Author
20 Feb 2006 7:48 AM
Brian Shafer
Hi,
I loved being about to use control arrays in vb classic.  Doesn't look like
i can do this in vb.net?
Any input?

Author
20 Feb 2006 8:53 AM
Peter Huang" [MSFT]
Hi Brian,

VB.NET and VB has the similar VB syntax, but the VB.NET is new designed
.NET programming language based on CLR.
The control array is no longer supported in VB.NET.
Here is link for your reference.

Control Array Changes in Visual Basic .NET
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbconcontrolarraychangesinvisualbasicnet.asp


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Author
20 Feb 2006 10:02 AM
Cor Ligthert [MVP]
Peter,

> Control Array Changes in Visual Basic .NET
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
> vbconcontrolarraychangesinvisualbasicnet.asp
>
Can that page not be removed or be corrected? It is not giving the right
information.
(there is so old that there is not even a link on that to report that).

See the answer from Randy.  I would have written something the same as he
had not done that.

Cor
Author
20 Feb 2006 8:56 AM
R. MacDonald
Hello, Brian,

I also thought that I would miss this feature.  I was wrong!

In .Net you can use arrays or collections of controls.  I think that
once you get into it you will find this is more versatile than the old
VB "control arrays".

One reason that I used to like the old VB control arrays was the ability
it gave to use the same event handler for a number of controls.  In .Net
you can not only assign the same event handler to multiple controls, but
(unlike with the old VB control arrays) the controls can be of diverse
types.  So for example, you can have the same handler deal with text
changes in a TextBox or a ComboBox.

Cheers,
Randy


Brian Shafer wrote:

Show quoteHide quote
> Hi,
> I loved being about to use control arrays in vb classic.  Doesn't look like
> i can do this in vb.net?
> Any input?
>
>
Author
20 Feb 2006 9:47 AM
Herfried K. Wagner [MVP]
"Brian Shafer" <bsgallatin@community.nospam> schrieb:
> I loved being about to use control arrays in vb classic.  Doesn't look
> like i can do this in vb.net?

Accessing controls by their names or indices
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=controlbynameindex&lang=en>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
20 Feb 2006 12:15 PM
CMM
Private myButtons As Button() = {Button1, Button2}

Private Sub Form_Load(...)
    For Each btn As Button In myButtons
        AddHandler btn.Click, AddressOf myButtons_Click
    Next btn
End Sub

or

Private Sub myButtons_Click(...) Handles Button1.Click, Button2.Click
....
End Sub

--
-C. Moya
www.cmoya.com