|
-
December 1st, 1999, 08:52 AM
#1
FTP in VB5
Hi,
I am trying to transfer a specific file between a Win95 PC and a HP-UX machine running unix. The process should be running in the background withour any intervention from the user.
Any help is very much appreciated.
Thank
-
December 1st, 1999, 09:09 AM
#2
Re: FTP in VB5
If you have IE3 or later installed on the machine, you can use my code from :
http://codeguru.developer.com/vb/articles/1852.shtml.
The code is contained in a class module you can simply drop into your project and use straight away.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
December 2nd, 1999, 03:34 AM
#3
Re: FTP in VB5
Hi Chris,
Thank for the tip. I've downloaded the sample but could not load the project. I am getting the 'Retained' is an invalid key error.
Pls help.
-
December 2nd, 1999, 03:43 AM
#4
Re: FTP in VB5
That's because it was written in VB6. You'll need to remove the first 3 lines at the top of the Class module (before the Option Explicit).
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
December 4th, 1999, 09:14 PM
#5
Re: FTP in VB5
Hi Chris,
Thank you for the tip. In your cFTP.cls module you call a REPLACE() function, but there is no REPLACE() function in your class or form module.
Pls help.
-
December 5th, 1999, 01:02 PM
#6
Re: FTP in VB5
I forgot about that - I don't think there's any other VB6 code in the project, but this VB5 code can be used to replace 'Replace' :
public Sub ReplaceAll(byref sOrigStr as string, _
byval sFindStr as string, _
byval sReplaceWithStr as string, _
optional bWholeWordsOnly as Boolean)
'
' Replaces all occurances of sFindStr with sReplaceWithStr
'
Dim lPos as Long
Dim lPos2 as Long
Dim sTmpStr as string
Dim bReplaceIt as Boolean
Dim lFindStr as Long
on error GoTo vbErrorHandler
lFindStr = len(sFindStr)
lPos2 = 1
bReplaceIt = true
sTmpStr = sOrigStr
Do
lPos = InStr(lPos2, sOrigStr, sFindStr)
If lPos = 0 then
Exit Do
End If
If bWholeWordsOnly then
on error resume next
If lPos = 1 Or (mid$(sOrigStr, lPos - 1, 1) = " ") then
If (mid$(sOrigStr, lPos + lFindStr, 1) = " ") Or mid$(sOrigStr, lPos + lFindStr + 1, 1) = "" then
bReplaceIt = true
else
bReplaceIt = false
End If
End If
End If
If bReplaceIt then
If lPos > 1 then
sTmpStr = Left$(sOrigStr, lPos - 1)
else
sTmpStr = ""
End If
sTmpStr = sTmpStr & sReplaceWithStr
sTmpStr = sTmpStr & mid$(sOrigStr, lPos + lFindStr, len(sOrigStr) - (lPos + lFindStr - 1))
sOrigStr = sTmpStr
End If
lPos2 = lPos + 1
Loop
sOrigStr = sTmpStr
Exit Sub
vbErrorHandler:
Err.Raise Err.Number, "ReplaceAll", Err.Description
End Sub
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
-
December 10th, 1999, 02:15 AM
#7
Re: FTP in VB5
Hi,
Can anybody give me a sample of how to transfer a file ie using FTP but WITHOUT overwriting it. The current FtpPutFile() will overwrite the file.
Thank you.
-
December 10th, 1999, 02:17 AM
#8
Re: FTP in VB5
Why dont you just use the VB function Replace()?
--
Chizl
[email protected]
http://www.chizl.com/
-
December 10th, 1999, 02:19 AM
#9
Re: FTP in VB5
My bad.. I have a simpler StringReplace function with less code if you want for VB5
--
Chizl
[email protected]
http://www.chizl.com/
-
December 10th, 1999, 02:58 AM
#10
Re: FTP in VB5
But does it have the 'whole-words only' option like mine ? I'd be interested to see it.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
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
|