How do you create an object array in VB.NET? It was bloody easy in VB5/6

  • Thread starter Thread starter Christian Blackburn
  • Start date Start date
C

Christian Blackburn

Hi Gang,
I can't seem to figure out how to create an object array in VB.NET 2003. In
VB6 you would just select an object copy and paste it and that was that. I
don't know why in the heck they decided to change that. I thought it was
great. I assume a 2002 answer would work in 2003 as well. Can somebody
tell me how to create an object array or point me to an MSDN article
regarding it?
Thanks,
Christian Blackburn
 
Hi Herfried,
Thank you very much for the help. I personally find this astounding that
Visual Basic 2003 does not native support for object arrays something I'm
pretty sure VB 1.0 for dos did! I don't know what's worse that VB 2002
didn't have object arrays or that 2003 didn't fix it :). All the same I
really appreciate your help and I'll go through their work around.
Cheers,
Christian
 
Hello,

Christian Blackburn said:
Visual Basic 2003 does not native support for object arrays
something I'm pretty sure VB 1.0 for dos did! I don't know
what's worse that VB 2002 didn't have object arrays or that
2003 didn't fix it :).

I am pretty sure (hoping) they will add control arrays in a future
release.

Regards,
Herfried K. Wagner
 
Hi Christian, Herfried,

There's a help topic: Control Array Changes in Visual Basic .NET

ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbconcontrolarraychangesinvisualbasic
net.htm

which says:

In Visual Basic .NET, control arrays are no longer supported. Changes to
the event model make control arrays unnecessary. Just as control arrays in
Visual Basic 6.0 could share events, the event model in Visual Basic .NET
allows any event handler to handle events from multiple controls. In effect,
this allows you to create groups of controls of disparate types that share
the same events.

I think they missed the point a bit.

Regards,
Fergus
 
Hi Fergus,
Thank you very much for the link. It didn't work in VB 2003.NET Trial even
though that does come with MSDN. However this worked great:
http://msdn.microsoft.com/library/d.../vbconcontrolarraychangesinvisualbasicnet.asp

and is of course the same URL more or less :).

I will also be reading the articles below, but what you sent me is a major
start towards reducing the bloat of my code so I already implemented what
you sent me and I'll read that big VB 2003 article in the morning (see
below). You see I have a board type game and currently it's 5x5 squares
(remember I'm talking functional squares that store pieces, not pixels
here), but I want it to be configurable for almost any WxH (width by height)
in squares.

VB Any and C#:
http://msdn.microsoft.com/library/d...ngcontrolarraysinvisualbasicnetvisualcnet.asp

VB 2003 Only:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/controlarrays.asp

Cheers,
Christian
 
Hi Fergus,

Fergus Cooney said:
In Visual Basic .NET, control arrays are no longer supported. Changes to
the event model make control arrays unnecessary. Just as control arrays in
Visual Basic 6.0 could share events, the event model in Visual Basic .NET
allows any event handler to handle events from multiple controls. In effect,
this allows you to create groups of controls of disparate types that share
the same events.

I think they missed the point a bit.

I couldn't agree more. There just isn't an easier way to make and work with
multiple objects of the same type. I'm sure I'm not the only board game
author out there that misses object arrays. The thing about their new event
model is that in VB6 if you created a procedure each event from every object
type can call the procedure so that sort of global event handling was
already possible :).
Cheers,
Christian Blackburn
 
Back
Top