Results 1 to 3 of 3

Thread: Coding question reg. arrays

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question Coding question reg. arrays

    I have a usercontrol with 50 equal orderlines and I wish to save the information from these to a file.
    I have shown some validation code for the array for orderline 7, how can I write a code for all the lines from 1 to 50 using a for-next? I have defined all the arrays Tal1(), Tal2()...Tal50().
    Other wise I have to write the code below for all of the 50 order lines, not smart :-(

    Code:
    If Tal7(2) <> 40 Then
                        swFileText.Write(Tal7(0) & ";")
                        swFileText.Write(Tal7(1) & ";")
                        swFileText.Write(Tal7(2) & ";")
                        swFileText.Write(Tal7(3) & ";")
                        swFileText.Write(Tal7(4) & ";")
                        swFileText.Write(Tal7(5) & ";")
                        swFileText.Write(Tal7(6) & ";")
                        swFileText.Write(Tal7(7) & ";")
                        swFileText.Write(Tal7(8) & ";")
                        swFileText.Write(Tal7(9) & ";")
                        swFileText.Write(Tal7(10) & ";")
                        swFileText.Write(Tal7(11) & ";")
                        swFileText.Write(Tal7(12) & ";")
                        swFileText.Write(Tal7(13) & ";")
                    End If

  2. #2
    Fanatic Member brown monkey's Avatar
    Join Date
    Jun 2004
    Location
    Cebu
    Posts
    552
    i don't know what i'm doing mate. hehe. but i think this is it. i'm not sure though
    VB Code:
    1. Dim s As String = ""
    2.       If Tal7(2) <> 40 Then
    3.          Dim i As Integer
    4.          For i = 0 To 49
    5.             s &= Tal7(i) & ";"
    6.          Next
    7.          swFileText.Write(s)
    8.       End If
    hope this helps mate.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049
    Thanks for your reply, the main problem is Tal7() (the array). I wish to make a for next which includes all of the arrays Tal1(), Tal2(), Tal3() ... Tal50(). The code for these should include the shown code for Tal7() replaced with e.g Tal1().

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