Results 1 to 10 of 10

Thread: vb6 code help....

  1. #1

    Joined
    Jun 2013
    Posts
    2
    Userbars
    0
    Thanks
    0
    Thanked
    0/0
    Mentioned
    Never
    Time Online
    27m
    Avg. Time Online
    N/A

    Angry vb6 code help....

    Block If without End If

    i cannot seem to find the problem



    Public Sub SaveData(LV As ListView, FilePath As String)
    Dim l As Long, intFF As Integer
    intFF = FreeFile
    With LV
    If .ListItems.Count > 0 Then



    Open FilePath For Append As #intFF
    For l = 1 To .ListItems.Count
    Print #intFF, .ListItems(l).Text & ";" & .ListItems(l).SubItems(1) & .ListItems(1).SubItems(2) & ";" & .ListItems(1).SubItems(3) & ";" & .ListItems(1).SubItems(4) & ";" & .ListItems(1).SubItems(5)


    Close #intFF
    End If

    End With

    End Sub

  2. #2

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    You forgot Next l before End If

  3. #3

    Joined
    Jun 2013
    Posts
    2
    Userbars
    0
    Thanks
    0
    Thanked
    0/0
    Mentioned
    Never
    Time Online
    27m
    Avg. Time Online
    N/A
    Quote Originally Posted by raredaredevil View Post
    You forgot Next l before End If
    i have tried this and still wont work.....

  4. #4
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Code:
    Public Sub SaveData(LV As ListView, FilePath As String)
        Dim l As Long, intFF As Integer
         intFF = FreeFile
          With LV
          If .ListItems.Count > 0 Then
                
             
                
                Open FilePath For Append As #intFF
                    For l = 1 To .ListItems.Count
                        Print #intFF, .ListItems(l).Text & ";" & .ListItems(l).SubItems(1) & .ListItems(1).SubItems(2) & ";" & .ListItems(1).SubItems(3) & ";" & .ListItems(1).SubItems(4) & ";" & .ListItems(1).SubItems(5)
                    Next 'l
                             
                Close #intFF
          End If
            
      End With
    
    End Sub

  5. #5

    Joined
    Dec 2011
    Posts
    151
    Userbars
    2
    Thanks
    4
    Thanked
    165/45
    DL/UL
    14/9
    Mentioned
    68 times
    Time Online
    6d 17h 26m
    Avg. Time Online
    2m
    Quote Originally Posted by dontplay View Post
    i have tried this and still wont work.....
    What error are you getting with the Next l, it worked for me?

  6. #6
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Perhaps OP should loop from 0 to .ListItems.Count - 1 ?

  7. The Following User Says Thank You to Zachafer For This Useful Post:

    DarkByte (06-19-2013)

  8. #7

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    That would not error though just loop 1 less than it should but yeah he should.

    .count starts from 1
    .index starts from 0

  9. #8
    Zachafer's Avatar
    Joined
    Dec 2011
    Posts
    1,235
    Userbars
    11
    Thanks
    769
    Thanked
    1,466/678
    DL/UL
    98/0
    Mentioned
    512 times
    Time Online
    24d 13h 9m
    Avg. Time Online
    8m
    Quote Originally Posted by raredaredevil View Post
    That would not error though just loop 1 less than it should but yeah he should.
    english please?

  10. #9

    Joined
    Jun 2012
    Posts
    1,699
    Thanks
    876
    Thanked
    2,881/1,142
    DL/UL
    44/1
    Mentioned
    562 times
    Time Online
    118d 6h 45m
    Avg. Time Online
    40m
    What part are you struggling with , He said his ide is giving him an error. The ide would not error for that reason.

  11. #10

    Joined
    Dec 2011
    Posts
    151
    Userbars
    2
    Thanks
    4
    Thanked
    165/45
    DL/UL
    14/9
    Mentioned
    68 times
    Time Online
    6d 17h 26m
    Avg. Time Online
    2m
    Quote Originally Posted by raredaredevil View Post
    What part are you struggling with , He said his ide is giving him an error. The ide would not error for that reason.
    Which is why I asked what error the dontplay is getting now.

  12. The Following User Says Thank You to Soredavide For This Useful Post:

    Zachafer (06-22-2013)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •