Topic "ASSISTANCE WITH VB.2010"

Author Message
lansin@ansintech.com
[View user's profile]
Donor
Joined: 2013-03-05
Posts: 3
Location: United States
I have an application written in VB 2010.
i would like to include within the VB2010 a procedure to auto upload a file from a specific folder to a remote site using winscp.
I have looked at the web site, but am having issues attempting to get started on including winscp so I can automatically upload the file.
It shouldn't be too hard, but I am wondering if someone can help.

Maybe pass to me sample code.

Thank you
Leonard
Advertisements
Taka
[View user's profile]
Donor
Joined: 2013-03-12
Posts: 3
Location: Leicester, MA
There is an example (in all sorts of languages) here:
http://winscp.net/eng/docs/library#example

Make sure you add WinSCP as a reference to your project.
lansin@ansintech.com
[View user's profile]
Donor
Joined: 2013-03-05
Posts: 3
Location: United States
Taka wrote:
There is an example (in all sorts of languages) here:
http://winscp.net/eng/docs/library#example

Make sure you add WinSCP as a reference to your project.


do I add winscp.dll as a reference?
thank you
Taka
[View user's profile]
Donor
Joined: 2013-03-12
Posts: 3
Location: Leicester, MA
lansin@ansintech.com wrote:
Taka wrote:
There is an example (in all sorts of languages) here:
http://winscp.net/eng/docs/library#example

Make sure you add WinSCP as a reference to your project.


do I add winscp.dll as a reference?
thank you


You may be able to do that. Even after doing the following I had to reference the DLL directly in my project because it was saying it could not find the DLL(which was strange because the object browser/intellisense was giving me access to everything in it). You will need to run RegAsm on the DLL, then it will show up under the ".NET" section when you add a reference.

See: http://winscp.net/eng/docs/library_install

Assuming .NET 4.0, and the WinSCP DLL being located at C:\WinSCP\:

Start -> Run -> %WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe "C:\WinSCP\WinSCP.dll" /codebase /tlb

You will also need the .exe file in the same directory as the .dll. If you get an error saying cannot find EXE, you may need to do something like this:
session.ExecutablePath = "C:\WinSCP\WinSCP.exe"
lansin@ansintech.com
[View user's profile]
Donor
Joined: 2013-03-05
Posts: 3
Location: United States
Taka wrote:
lansin@ansintech.com wrote:
Taka wrote:
There is an example (in all sorts of languages) here:
http://winscp.net/eng/docs/library#example

Make sure you add WinSCP as a reference to your project.


do I add winscp.dll as a reference?
thank you


You may be able to do that. Even after doing the following I had to reference the DLL directly in my project because it was saying it could not find the DLL(which was strange because the object browser/intellisense was giving me access to everything in it). You will need to run RegAsm on the DLL, then it will show up under the ".NET" section when you add a reference.

See: http://winscp.net/eng/docs/library_install

Assuming .NET 4.0, and the WinSCP DLL being located at C:\WinSCP\:

Start -> Run -> %WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe "C:\WinSCP\WinSCP.dll" /codebase /tlb

You will also need the .exe file in the same directory as the .dll. If you get an error saying cannot find EXE, you may need to do something like this:
session.ExecutablePath = "C:\WinSCP\WinSCP.exe"


I setup a windows form sing VB2010 the code looks as follows:
I did register the winscp.dll

But at this point a need some help

how do I open winscp
tell it what options I need
such as ftp name, user name, certificate

I thank you in advance for you help.
leonard, Waltham

Option Explicit On
Option Strict Off
Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports System.Diagnostics.Process
'Imports System.Net.Mail
Imports EASendMail 'ad easendmail namespace
Imports WinSCP

Public Class form1
Public NotInheritable Class SessionOptions

End Class
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

End Sub

Public Sub Open(ByVal sessionOptions As SessionOptions)


End Sub
End Class
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
lansin@ansintech.com wrote:
how do I open winscp
tell it what options I need
such as ftp name, user name, certificate

Have you seen a VB page for the assembly?
http://winscp.net/eng/docs/library_vb
I hope it gives you all you need. If you have a specific question, let us know.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License