-
Jun 2nd, 2006, 10:53 AM
#1
Thread Starter
Addicted Member
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:
Dim pass As String
Set oFTP = New CFtp
oFTP.Connect "ftp.guitar.gratisplaneten.com", "xxxxxx", "xxxxxxxx"
oFTP.TransferType = FTP_TRANSFER_TYPE_ASCII 'or FTP_TRANSFER_TYPE_BINARY
oFTP.DownloadFile username & ".txt", "/guitar.gratisplaneten.com/adam/users/" & username & ".txt"
Dim oFile As CFtpFile
For Each oFile In oFTP.Files
If oFile.IsDirectory Then
List1.AddItem "[" & oFile.FileName & "]"
Else
List1.AddItem oFile.FileName
End If
Next
oFTP.CloseConnection
Open username & ".txt" For Input As #1
Input #1, pass
If pass <> password Then
Close
Kill username & ".txt"
MsgBox "The username or password is incorrect"
Else
Input #1, points
Close
Kill username & ".txt"
Load frm_main
frm_main.Caption = frm_main.Caption & " - Logged in as " & username & " [" & points & " points]"
frm_main.Show
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
-
Jun 2nd, 2006, 11:13 AM
#2
Re: Help with my password code
have you tried to put a doevents after "oFTP.DownloadFile ..."
-
Jun 2nd, 2006, 11:15 AM
#3
Thread Starter
Addicted Member
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!
-
Jun 2nd, 2006, 11:43 AM
#4
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
-
Jun 3rd, 2006, 05:14 AM
#5
Thread Starter
Addicted Member
Re: Help with my password code
mm, that's also an idea....I'll try it all soon...tnx!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|