Results 1 to 5 of 5

Thread: Help with my password code

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Unhappy Help with my password code

    Hi everybody!

    I'm building a program with a login box in the beginning...this is my code:

    VB Code:
    1. Dim pass As String
    2. Set oFTP = New CFtp
    3. oFTP.Connect "ftp.guitar.gratisplaneten.com", "xxxxxx", "xxxxxxxx"
    4. oFTP.TransferType = FTP_TRANSFER_TYPE_ASCII 'or FTP_TRANSFER_TYPE_BINARY
    5. oFTP.DownloadFile username & ".txt", "/guitar.gratisplaneten.com/adam/users/" & username & ".txt"
    6. Dim oFile As CFtpFile
    7. For Each oFile In oFTP.Files
    8.     If oFile.IsDirectory Then
    9.         List1.AddItem "[" & oFile.FileName & "]"
    10.     Else
    11.         List1.AddItem oFile.FileName
    12.     End If
    13. Next
    14. oFTP.CloseConnection
    15. Open username & ".txt" For Input As #1
    16.     Input #1, pass
    17. If pass <> password Then
    18.     Close
    19.     Kill username & ".txt"
    20.     MsgBox "The username or password is incorrect"
    21. Else
    22.     Input #1, points
    23.     Close
    24.     Kill username & ".txt"
    25.     Load frm_main
    26.     frm_main.Caption = frm_main.Caption & " - Logged in as " & username & " [" & points & " points]"
    27.     frm_main.Show
    28. End If

    My problem is that I get an "Run-time error '53': File not found" when I run the code.
    The problem is that it can't open the username file since it hasn't been downloaded...why is this?

    The FTP stuff I'm using is Joackim Anderssons code here.

    If you have any problems understanding my code...plz say so. Then I can describe what the code does.

    Happy for help!

    //Alex
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  2. #2
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: Help with my password code

    have you tried to put a doevents after "oFTP.DownloadFile ..."

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Help with my password code

    good idea...I'll try it..can't try now...but I'll do it when I've got time!
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  4. #4
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Help with my password code

    I think you should wait for the oFTP_TransferCompleted event, and then continue with the rest of the code

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: Help with my password code

    mm, that's also an idea....I'll try it all soon...tnx!
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

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