Skip to content

String Reference not set to an instance of a String: Parameter name: s #382

Closed
@Michael-Meredith

Description

@Michael-Meredith

I am working on a program that must upload files to various clients it has worked well except for one client.

I have stripped out the relevant code that I am using to make it easier to debug and I have included it below.

I get the error as per the subject line of this submission when I execute it, can anyone provide some clarity for me as to what am doing wrong, I am an old programmer and have learnt to accept that it is invariably my fault:

The error occurs when it tries to execute the connect

The program is written in Visual Basic using Visual Studio 3013

Imports Renci.SshNet

Public Class Form

Private Sub cmdConnect_Click(sender As Object, e As EventArgs) Handles cmdConnect.Click

    Dim strURL As String
    Dim strPort As Integer
    Dim strUser As String
    Dim strPassword As String
 
    strURL = "xxxxxxx"
    strPort = 22
    strUser = "xxx"
    strPassword = "XXXXXXXXXXXX"

    Try

        Dim kauth As New KeyboardInteractiveAuthenticationMethod(strUser)

        Dim pauth As New PasswordAuthenticationMethod(strUser, strPassword)

        Dim ConnNfo As New ConnectionInfo(strURL, strPort, strUser, pauth, kauth)

        Using Sftp As New SftpClient(ConnNfo)

            Sftp.Connect()

        End Using

        MsgBox("Connected")

    Catch ex As Exception

        MsgBox(ex.Message)

    End Try

End Sub

End Class

Regards

Juliana

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions