If the Ftp_Server have no file.......the program will hold and not working ......please help me~ 
Author Message
 If the Ftp_Server have no file.......the program will hold and not working ......please help me~

I design a ftp program by use inet controls ~

this is my code:
 FtpLink.Execute "ftp://127.0.0.1", "dir"

If the Ftp_Server have no file.......the program will hold and not working
why???
and how to solve the problem...

thanks a lot~


Steven.

it is some of the complete code?G

Private Sub Form_Load()
 FileDirReflash = True
 FtpLink.Execute "ftp://127.0.0.1", "dir"
End Sub

Private Sub FtpLink_StateChanged(ByVal STATE As Integer)
 Dim vtData As Variant
 Dim strData As String: strData = ""
 Dim bDone As Boolean
 Dim i As Integer
 Dim j As Integer
 Dim strData1 As String
 Dim strData2 As String
 Dim GetFile As String

 Select Case STATE
  'Case icError
  '     MsgBox "error"
  'Case icReceivingResponse
  '     MsgBox "error"
  Case icResponseCompleted
   If FileDirReflash Then
    vtData = FtpLink.GetChunk(1024, icString)
    DoEvents
     Do While Not bDone
       strData = strData & vtData
       vtData = FtpLink.GetChunk(1024, icString)

       DoEvents
       If Len(vtData) = 0 Then
        bDone = True
       End If
      Loop

      i = 1
      FileList.Clear

      Do While InStr(i, strData, vbCrLf) <> 0
       strData1 = Trim(Mid(strData, i, InStr(i, strData, vbCrLf) - i))
       strData2 = ""
       For j = 1 To Len(strData1)
         If Asc(Mid(strData1, j, 1)) > 31 And Asc(Mid(strData1, j, 1)) < 127
Then strData2 = strData2 & Mid(strData1, j, 1)
       Next j

       If Len(Trim(strData2)) <> 0 Then
         If Right(strData2, 1) = "/" Then strData2 = "/" & Left(strData2,
Len(strData2) - 1)
           FileList.AddItem strData2
         End If
         i = InStr(i, strData, vbCrLf) + 1
      Loop
      Timer1.Enabled = True
   End If
 End Select
End Sub



Sun, 21 Sep 2003 12:12:44 GMT  
 If the Ftp_Server have no file.......the program will hold and not working ......please help me~
Try this:

Private Sub Form_Load()
FileDirReflash = True
FtpLink.Execute "ftp://127.0.0.1", "dir"
Do
DoEvents
Loop While FtpLink.StillExecuting
End Sub

-Jani

Quote:

>I design a ftp program by use inet controls ~

>this is my code:
> FtpLink.Execute "ftp://127.0.0.1", "dir"

>If the Ftp_Server have no file.......the program will hold and not working
>why???
>and how to solve the problem...

>thanks a lot~


>Steven.

>it is some of the complete code?G

>Private Sub Form_Load()
> FileDirReflash = True
> FtpLink.Execute "ftp://127.0.0.1", "dir"
>End Sub

>Private Sub FtpLink_StateChanged(ByVal STATE As Integer)
> Dim vtData As Variant
> Dim strData As String: strData = ""
> Dim bDone As Boolean
> Dim i As Integer
> Dim j As Integer
> Dim strData1 As String
> Dim strData2 As String
> Dim GetFile As String

> Select Case STATE
>  'Case icError
>  '     MsgBox "error"
>  'Case icReceivingResponse
>  '     MsgBox "error"
>  Case icResponseCompleted
>   If FileDirReflash Then
>    vtData = FtpLink.GetChunk(1024, icString)
>    DoEvents
>     Do While Not bDone
>       strData = strData & vtData
>       vtData = FtpLink.GetChunk(1024, icString)

>       DoEvents
>       If Len(vtData) = 0 Then
>        bDone = True
>       End If
>      Loop

>      i = 1
>      FileList.Clear

>      Do While InStr(i, strData, vbCrLf) <> 0
>       strData1 = Trim(Mid(strData, i, InStr(i, strData, vbCrLf) - i))
>       strData2 = ""
>       For j = 1 To Len(strData1)
>         If Asc(Mid(strData1, j, 1)) > 31 And Asc(Mid(strData1, j, 1)) <
127
>Then strData2 = strData2 & Mid(strData1, j, 1)
>       Next j

>       If Len(Trim(strData2)) <> 0 Then
>         If Right(strData2, 1) = "/" Then strData2 = "/" & Left(strData2,
>Len(strData2) - 1)
>           FileList.AddItem strData2
>         End If
>         i = InStr(i, strData, vbCrLf) + 1
>      Loop
>      Timer1.Enabled = True
>   End If
> End Select
>End Sub



Sun, 21 Sep 2003 13:11:28 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. If the Ftp_Server have no file.......the program will hold and not working ....please help me~

2. Hi, I am having trouble with bar code font not working

3. Working with Word files and templates without having Word

4. Working with MSWord files without having Word

5. VB.NET app does not run on OS having .NET redistributable files installed

6. Willing to work for free....

7. Programmer willing to work very inexpensively

8. Having a BASIC program launch another program

9. Any newbie programs you would be willing...

10. HELP: VB 6 works with Access97 file, not Access 2000 file

11. File.Get does not work with files created outside of eVB

12. Program works in debugger, not when compiled

 

 
Powered by phpBB® Forum Software