Results 1 to 6 of 6

Thread: Class Array Question

  1. #1

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Class Array Question

    How come I have to do this..
    VB Code:
    1. Dim a7
    2. a7 = classname.ClassVariant
    3. a7(X, Y) = 3
    4. classname.ClassVariant = a7
    When I would like to do this
    VB Code:
    1. classname.ClassVariant(X, Y) = 3
    Class variant is a variant declared as public in a class declarations area.

    Its bugging me.

    ??
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  2. #2

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Class Array Question

    If I don't use the more long winded aproach the array does not get equated. Do I have to do this because my declaration of the array in the class is..

    VB Code:
    1. Public ClassVariant
    rather than ...

    VB Code:
    1. Public ClassVariant() as Variant


    ?
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  3. #3
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Class Array Question

    If it doesn't allow you to do that, you will have to create a function within the class that sets the values instead:
    VB Code:
    1. 'class
    2. Public Function SetVariant(x As Integer, y As Integer, val As Integer) As Long
    3. ClassVariant(x, y) = val
    4. End Function
    5. 'form
    6. classname.SetVariant x, y, 3
    Or your way. I don't think there is a way around it..

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  4. #4

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Class Array Question

    Which is of course the propper way of doing things. But a pain none the less. Thanks for the reminder phReAk.

    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

  5. #5
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: Class Array Question

    Np what-so-ever. I do realise it would be easier to do it your way (the second way), but hey, I think that's what .NET is for (?)

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  6. #6

    Thread Starter
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: Class Array Question

    I can't help thinking that Microsoft just didn't want to finsh VB. I hate that. Here we all are trying to put out the best software we can, having to use code that needs get arounds for virtually everything you want to do.

    Its a bummer.

    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

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