Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VB and Internet Transfer Control

VB and Internet Transfer Control

VB and Internet Transfer Control

I need to implement FTP in an application and
would like some code samples that I could study. Does
anyone know of some code samples using ITC in VB?

RE: VB and Internet Transfer Control

Check this site out:

RE: VB and Internet Transfer Control

Perhaps these two functions could give you a start, uses the internet transfer control that comes with VB. Bit mickey mouse, should be more paramaterised - but does have the major thing about the itc. Each time you ask it to do something - wait for it to finish.



Public Sub WaitForIC(ic As Inet)

' waits for an internet transfer control, ic,
' to finish what it's doing - if anything

With ic
Loop While .StillExecuting
End With

End Sub

Public Function XferFile( _
itc as Inet, _
fname As String _
) As Boolean

On Error GoTo XferFile_ErrHandler

' Transfers a file to a target machine.

Dim lsHostName As String
Dim lsUserName As String
Dim lsPassword As String
Dim lsTmpDirName As String
Dim lsTargetdir As String

Dim lsCDcmd As String
Dim lsPUTcmd As String
Dim lsMsg As String

' XferFile = True: Exit Function

If (fname = vbNullString) Then
XferFile = False
Exit Function
End If

Call WaitForIC(itc)

lsHostName = "some.computer.com"
lsUserName = "valid_user_name"
lsPassword = "valid_password"
lsTargetdir = "dir_on_lsHostName"

' lsPUTcmd = "PUT " & lsTmpDirName _
& fname & " " & lsTargetdir & fname _
& " PUT " & lsTmpDirName & fname & " " _
& lsTargetdir & "tmpthing.txt"

itc.AccessType = icDirect
Call WaitForIC(itc)

itc.Protocol = icFTP
Call WaitForIC(itc)

itc.URL = "ftp://" & lsHostName
Call WaitForIC(itc)

itc.UserName = lsUserName
Call WaitForIC(itc)

itc.Password = lsPassword
Call WaitForIC(itc)

itc.Execute itc.URL, lsPUTcmd
Call WaitForIC(itc)

XferFile = True

Exit Function


lsMsg = "An Error has occurred whilst transferring" _
& " a file to the Target Computer." _
& " Check the Status display for error" _
& " messages, you may have to use the scroll" _
& " bar to see all of the messages." _
& vbCrLf & vbCrLf

If mLastInetResponseCode <> 0 Then
lsMsg = lsMsg _
& " The last recorded response from the" _
& " Target Computer was:" & vbCrLf & vbCrLf _
& mLastInetResponseCode & ": " _
& mLastInetResponseInfo _
& vbCrLf & vbCrLf
End If

txtConvError.Text = lsMsg _
& vbCrLf & vbCrLf & txtConvError.Text

XferFile = False
Exit Function

End Function

RE: VB and Internet Transfer Control

You might also be able to find some useful source at http://www.pragrammersheaven.com
not sure, but it's a shot

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close