Results 1 to 11 of 11

Thread: Declaration

  1. #1

    Thread Starter
    Lively Member haruki's Avatar
    Join Date
    Mar 2005
    Location
    Shibuya / Japan
    Posts
    118

    Declaration

    Is it possible to declare with an index?

    Dim tile(index) as long

  2. #2
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: Declaration

    you can declare with a constant - if you want to declare with a variable you need to:

    dim X() as long
    redim X(index)
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  3. #3

    Thread Starter
    Lively Member haruki's Avatar
    Join Date
    Mar 2005
    Location
    Shibuya / Japan
    Posts
    118

    Re: Declaration

    And how do I declare it with a constant?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Declaration

    Quote Originally Posted by haruki
    And how do I declare it with a constant?
    VB Code:
    1. 'form level
    2. Private Const MYINDEX = Whatever
    3. 'event level
    4. Const MYINDEX = Whatever
    Last edited by Hack; Apr 25th, 2005 at 07:44 AM.

  5. #5
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: Declaration

    dim i(5) as long
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  6. #6

    Thread Starter
    Lively Member haruki's Avatar
    Join Date
    Mar 2005
    Location
    Shibuya / Japan
    Posts
    118

    Re: Declaration

    Hm.. So if I want to use this for example how do I need to declare?


    VB Code:
    1. For i = 1 to 10
    2. Tile(i) = LoadGraphicDC(App.Path & "\tile" & i & ".bmp")
    3. Next i
    Last edited by haruki; Apr 25th, 2005 at 07:55 AM.

  7. #7
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: Declaration

    Dim Tile(10) as long
    Last edited by THEROB; Apr 25th, 2005 at 09:45 AM.
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  8. #8

    Thread Starter
    Lively Member haruki's Avatar
    Join Date
    Mar 2005
    Location
    Shibuya / Japan
    Posts
    118

    Re: Declaration

    UH?

    I dont understand, give me the whole idea. How do I need to declare from scratch to get that to work.

  9. #9
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: Declaration

    VB Code:
    1. Dim Tile(10) As Long
    2.     Dim i As Long
    3.    
    4.     For i = 1 To 10
    5.         Tile(i) = LoadGraphicDC(App.Path & "\tile" & i & ".bmp")
    6.     Next i
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  10. #10

    Thread Starter
    Lively Member haruki's Avatar
    Join Date
    Mar 2005
    Location
    Shibuya / Japan
    Posts
    118

    Re: Declaration

    and if i want to do

    VB Code:
    1. Tile(1) = "1adf234"
    2. Tile(3) = "43adfadf"

    Why add 10? like you did "dim Tile(10)"?

  11. #11
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Re: Declaration

    I did Dim Tile(10) because you gave your example of having i = from 1 to 10.

    The statement Dim Tile(10) as long, creates an array with elements from 0 to 10. If you only need 3 items use Dim Tile(3) as long.

    You only need to declare the array to be the size you need.

    Clear??


    R
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

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