Results 1 to 7 of 7

Thread: An array?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Hampshire
    Posts
    32

    Question

    I would like to know what an array is?

    Im a VB student who's teacher who just aint answering all my questions.

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Well its like a table that can hold things in every cell.

    for instance, MyArray(1 to 5) would be like this
    Code:
    __________________________
    |____|____|____|____|____|
    to use them, you would say something like:
    MyArray(1) would get you the first cell in the array.

    Loops can also do this

    Code:
    dim i as integer
    for i = 1 to 5
        MyArray(i) 'bla bla bla
    next i
    ask if you need any help

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Hampshire
    Posts
    32
    Well I dont quite understand those For...Next statements.
    could you please explain that?

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    For...Next is a type of reptition structure that runs through the values of the given variable starting at the first number specified to the second number specified. Both numbers could be a specific number or a variable with a numeric value. The code between the For and the Next is executed and then the variable value is automatically incremented by a specified value(The default is +1). NOTE:
    After the For...Next loop is finished running, the value of the variable is equal to the second number plus the increment value.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Hampshire
    Posts
    32
    Thanks to all of you guys.

    I really dont quite get it without example code
    could u give an example?

  6. #6
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    This will print 1 through 10 in the debugger. Press the F8
    key so you are able to step into the code.

    Code:
    Private Sub Command1_Click()
      Dim i As Integer
      For i = 1 To 10
          Debug.Print (i)
      Next i
    End Sub

  7. #7

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Hampshire
    Posts
    32
    ok i did the debug thing with that example code
    and wow! its somewhat clicking. but the i was supposed to go to 10 and it went to 11. what up with that?

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