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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian Blackburn

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

    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


  • Herfried K. Wagner [MVP]

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

    Hello,

    "Christian Blackburn" <Christian@Damn @Spam@Hotmail.c om> schrieb:[color=blue]
    > 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.[/color]

    Creating Control Arrays in Visual Basic .NET and Visual C# .NET


    HTH,
    Herfried K. Wagner
    --
    MVP · VB Classic, VB .NET
    Die Website von H. Wagner zu .NET, Visual Basic .NET, Classic Visual Basic, Webentwicklung und mehr.



    Comment

    • Christian Blackburn

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

      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

      "Herfried K. Wagner [MVP]" <hirf.nosp@m.ac tivevb.de> wrote in message
      news:Ot0exdmaDH A.1748@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Hello,
      >
      > "Christian Blackburn" <Christian@Damn @Spam@Hotmail.c om> schrieb:[color=green]
      > > 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.[/color]
      >
      > Creating Control Arrays in Visual Basic .NET and Visual C# .NET
      >[/color]
      http://msdn.microsoft.com/library/?u...VisualCNET.asp[color=blue]
      >
      > HTH,
      > Herfried K. Wagner
      > --
      > MVP · VB Classic, VB .NET
      > http://www.mvps.org/dotnet
      >
      >[/color]


      Comment

      • Herfried K. Wagner [MVP]

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

        Hello,

        "Christian Blackburn" <Christian@Damn @Spam@Hotmail.c om> schrieb:[color=blue]
        > 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 :).[/color]

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

        Regards,
        Herfried K. Wagner
        --
        MVP · VB Classic, VB .NET
        Die Website von H. Wagner zu .NET, Visual Basic .NET, Classic Visual Basic, Webentwicklung und mehr.



        Comment

        • Fergus Cooney

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

          Hi Christian, Herfried,

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

          ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbconcontrolarr aychangesinvisu albasic
          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


          Comment

          • Christian Blackburn

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

            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:


            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#:


            VB 2003 Only:


            Cheers,
            Christian


            "Fergus Cooney" <wollus@tesco.n et> wrote in message
            news:ODCjkAoaDH A.1740@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Hi Christian, Herfried,
            >
            > There's a help topic: Control Array Changes in Visual Basic .NET
            >
            >[/color]
            ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vbconcontrolarr aychangesinvisu albasic[color=blue]
            > net.htm
            >
            > which says:
            >
            > In Visual Basic .NET, control arrays are no longer supported. Changes[/color]
            to[color=blue]
            > 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[/color]
            effect,[color=blue]
            > 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
            >
            >[/color]


            Comment

            • Christian Blackburn

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

              Hi Fergus,

              "Fergus Cooney" <wollus@tesco.n et> wrote in message
              news:ODCjkAoaDH A.1740@TK2MSFTN GP10.phx.gbl...[color=blue]
              > In Visual Basic .NET, control arrays are no longer supported. Changes[/color]
              to[color=blue]
              > 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[/color]
              effect,[color=blue]
              > this allows you to create groups of controls of disparate types that share
              > the same events.
              >
              > I think they missed the point a bit.[/color]

              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[color=blue]
              >
              >[/color]


              Comment

              Working...