Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2004, 05:06 AM
Registered User
 
Join Date: Mar 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tried to run the putfile in XP box, and it working fine.

                ' --------------------
                ' Transfer via standard FTP
                ServerName = strLocation.ToUpper
                FTPLogin = txtUserID.Text
                FTPPassword = txtPassword.Text

                ' Instantiate a new FTP object
                Dim INet, INetConn As Integer
                Dim RC As Boolean
                ' FTP_TRANSFER_TYPE_ASCII
                ' FTP_TRANSFER_TYPE_BINARY
                INet = InternetOpen("CTM_SMS_FTP_Control", 1, vbNullString, vbNullString, 0)
                INetConn = InternetConnect(INet, ServerName, 0, FTPLogin, FTPPassword, 1, 0, 0)
                RC = FtpPutFile(INetConn, strFileName, "\a\upload.txt", 0, 0)

                If RC Then
                    MsgBox("Transfer succesfull!")
                End If
                InternetCloseHandle(INetConn)
                InternetCloseHandle(INet)

                '------------------

Keung
 
Old April 13th, 2004, 12:15 PM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I attempted to use fig000's solution, and have another problem altogether. I can't figure out where the references in the code are called from. I receive the following errors:

Name 'InternetOpen' is not declared
Name 'InternetConnect' is not declared
Name 'FTPGetFile' is not declared
Name 'InternetCloseHandle' is not declared

Do I need to add a reference for these objects to be recognized? I'm rather new to VB, and any assistance would be appreciated.



 
Old April 13th, 2004, 10:02 PM
Registered User
 
Join Date: Jul 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you use the declarations at the top of the code snippet? That should take care of declarations. And I kind of doubt those dlls wouldn't be on your hard drive.

Fig000

 
Old April 16th, 2004, 11:27 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Fig! I'm rokken like Don Dokken!

My apologies for not reading your original code snippet more closely. I actually did an FTPPutFile, so I'll post that sample for diversity's sake:

        Dim INet, INetConn As Integer
        Dim RC As Boolean
        INet = InternetOpen("blah", 1, vbNullString, vbNullString, 0)
        INetConn = InternetConnect(INet, "remoteIPAddresshere", 0, "myUserId", "myPassword", 1, 0, 0)
        RC = FtpPutFile (INetConn, "C:\LDir1localfile.txt", "/RDir1/RDir2/remotefile.txt", 0, 0)
        If RC Then MessageBox.Show("Transfer successful!")
        InternetCloseHandle(INetConn)
        InternetCloseHandle(INet)
 
Old April 19th, 2004, 07:38 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've successfully ftp within a LAN using the codes here. Thanks a lot.

But now I need to ftp from my LAN to a remote server in another LAN. There are gateways for both LANs. Not sure how to set the proxyName and proxyPassby parameters for the InternetOpen function. I've changed the AccessType to 0, presumably representing access_by_proxy. Also tried to use the ip addresses of the gateways as the proxy. but havn't been successful. Any experiences on that? Thanks.

 
Old April 29th, 2004, 04:17 AM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi ppl,

I am Having the same problem as mikeymac,

Name 'InternetOpen' is not declared
Name 'InternetConnect' is not declared
Name 'FTPGetFile' is not declared
Name 'InternetCloseHandle' is not declared

What exactly do i have to do to solve this problem?
I tried to put these code below right under the iherits... Where exactly do i have to put the code..

Dim INet, INetConn As Integer
Dim RC As Boolean


Thanks alot.

Dave



 
Old August 27th, 2004, 09:27 AM
Registered User
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I run the code in my XP. It works well.

I am wondering how to download file in the BACKGROUND so I can still use my foreground to do other things. Any suggestion or comments?

Thank in advance,
Rebecca
 
Old September 2nd, 2004, 01:20 PM
Registered User
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

My code works fine too. However, is there a way to make file name NOT case-sensitive? For example, when getting file "FOO.txt" from the server and on the server name is "foo.txt" the program could not find it.

Any ideas?

Thanks
 
Old September 9th, 2004, 03:29 PM
Registered User
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to TDot Send a message via Yahoo to TDot
Default

Here ya go people...

http://support.microsoft.com/default...b;en-us;832679

 
Old September 13th, 2004, 06:36 PM
Registered User
 
Join Date: Jul 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

TDOT,

  Thanks for the link. I started this thread over a year ago and it seems like there was no formal description of how to do this. I think the MS version is more compicated than mine but probably has more features.

  This thread has had a long life :-).

Fig






Similar Threads
Thread Thread Starter Forum Replies Last Post
Uploading Text File to FTP server in vb.net KiruShan .NET Framework 2.0 4 July 29th, 2014 02:02 AM
loop through tables inside .mdb file using VB.NET remya1000 General .NET 3 September 24th, 2007 12:45 PM
Start a program inside another program Silje Classic ASP Professional 1 November 16th, 2004 02:08 AM
Running FTP within VB .NET Application ocarroll General .NET 7 September 28th, 2004 04:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.