Sua classe não se chama FTP
deve possuir um construtor parecido com isso, mas FTPServ, fiz umas modificações:
Public Class FTPFTPServ
Dim URIFTP As String = ""
Dim SWServidor As WebRequest = FtpWebRequest.Create(URIFTP)
Private servidor_Host As String
Private usuario_Password As String
Private senha_User As String
'construtorPublic Property HostnameP As String
Get
Return _Host
End Get
Set(ByVal V As String)
End Set
End Property
Public Property UsuárioP As String
Get
Return _Host
End Get
Set(ByVal V As String)
End Set
End Property
Public Property SenhaP As String
Get
Return _Password
End Get
Set(ByVal V As String)
End Set
End Property
Public Sub New(servidorByVal usuario As String, usuarioByVal senha As String, senhaByVal domain As String)
Me.servidor_Host = servidordomain
Me._Password = senha
Me._User = usuario
End Sub
Public Sub UploadFile(ByVal URLArquivo As String, Destino As String)
' SWServidor.Credentials = New NetworkCredential(Hostname, Usuário, Senha)
SWServidor.Method = WebRequestMethods.Ftp.UploadFile
Try
Dim ByteFile() As Byte = System.IO.File.ReadAllBytes(Destino)
Dim MyStream As System.IO.Stream = SWServidor.GetRequestStream()
MyStream.Write(ByteFile, 0, ByteFile.Length)
MyStream.Close()
MyStream.Dispose()
Catch ex As Exception
MsgBox("Erro")
End Try
End Sub
End Class
Public Sub New(ByVal usuario As String, ByVal senha As String, ByVal domain As String)
Me.senha_Host = domain
Me._Password = senha
Me._User = usuario
End Sub
Public Sub UploadFile(ByVal URLArquivo As String, Destino As String)
' SWServidor.Credentials = New NetworkCredential(Hostname, Usuário, Senha)
SWServidor.Method = WebRequestMethods.Ftp.UploadFile
Try
Dim ByteFile() As Byte = System.IO.File.ReadAllBytes(Destino)
Dim MyStream As System.IO.Stream = SWServidor.GetRequestStream()
MyStream.Write(ByteFile, 0, ByteFile.Length)
MyStream.Close()
MyStream.Dispose()
Catch ex As Exception
MsgBox("Erro")
End Try
End Sub
End Class
Você declara assim:
Dim ftp As New FTPServ("Servidor", "Usuário" , "Senha")