ASSISTANCE WITH VB.2010

Advertisement

lansin@ansintech.com
Donor
Joined:
Posts:
3
Location:
United States

ASSISTANCE WITH VB.2010

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

Reply with quote E-mail

Advertisement

Taka
Donor
Joined:
Posts:
3
Location:
Leicester, MA

lansin@ansintech.com wrote:

Taka wrote:

There is an example (in all sorts of languages) here:
https://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: https://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"

Reply with quote

lansin@ansintech.com
Donor
Joined:
Posts:
3
Location:
United States

added reference and started code but need help, please!

Taka wrote:

lansin@ansintech.com wrote:

Taka wrote:

There is an example (in all sorts of languages) here:
https://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: https://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

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: added reference and started code but need help, please!

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?
https://winscp.net/eng/docs/library_vb
I hope it gives you all you need. If you have a specific question, let us know.

Reply with quote

Advertisement

You can post new topics in this forum