Results 1 to 3 of 3

Thread: Why?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    Post

    Hi, look at the code below...Sub cmdGet()
    N = 0
    Dim ret As Long
    Dim Temp As String * 100
    Do Until ret <= 1
    N = N + 1
    ret = GetPrivateProfileString(AppName, "n" & N, vbNull, Temp, Len(Temp), FlName)
    If ret <= 1 Then
    GoTo nextn
    Else
    Sleeping.List1.AddItem Trim(Temp)
    End If
    nextn:
    Loop
    End Sub

    then the sub doesn't work. and when i replace the Do with the For statement it works. can anybody show me what's wrong...

  2. #2
    Guest

    Post

    RET is immediately less than 1, so it never executes!!!

    when you Dim a new variable, it sets it to 0.

    theres your problem.
    if you want it to execute at least once, put the Until ret <=1 next to the loop word

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    Post

    thank you wossman

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