Results 1 to 4 of 4

Thread: Damn variables

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    92

    Question

    Hey Colleges!!!

    I have this question that's REALLY consuming me time!

    I have this module where i made a Public type with 2000 "sub variables":

    Public type Var1
    v1 as long
    v2 as long
    v3 as long
    ...
    end type

    Each variable has 3 numbers separated with "," .
    What i want to do is write a simple way of taking the values i put into each of the 2000 variables
    Thats because i need to put the 3 numbers in a vb function, this is what i tryed:

    For i = 1 To 2000

    ii = 0 + 50

    Dim a, b, c As String

    a = Mid(Var1.v(i), 1, 4)
    b = Mid(Var1.v(i), 5, 4)
    c = Mid(Var1.v(i), 9, 4)

    Picture1.PSet (0, ii), RGB(a, b, c)

    Next

    This doesn't work, and i wouldn´t like to write 2000 times the same code to take the values!

    I appreciate any kind of help!

    Thanks a lot guys!!

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    WHATTT??? WOOOWW??

    You want to use 2000 variables???
    hmm.. this doesn't seem to cool...
    Use an array instead...

    oh and
    Dim a, b, c As String
    is a realllll bad thing..
    because a and b are declared as variants (which is not good in this case if you have alot of them )
    use
    Dim a As String, b As String, c As String
    instead, but to keep it clean
    use
    Dim a$, b$, c$
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    92
    And i'm planning to use more variables, lol, but anyway,
    if i use an array can i use the code i wrote? but if i do so i put the array where? Cause i need to make em accessable throught the program...

    Thanks again!

    Awaiting reply... Login OFF

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    How about an array of longs:
    Code:
    Public type Var1 
      v(1999) as long 
    End type
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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