Hi everyone,
I am currently working on developing some code for transfer file from one pc to another. As I read in lot of article, those work can be done by FTP concept.
I'm using win7 and VB.NET 2010
I've got some simple source code for uploading a file, but I'm experiencing a problem which describe below
[code]System.ArgumentNullException was unhandled
Message=Value cannot be null.
Parameter name: type
ParamName=type
Source=mscorlib[/code]
it's refers to:
[code]ITCObject = Activator.CreateInstance(ITC)[/code]
Here are the source code:
[code]Imports System.IO
Imports System.Reflection
Imports System.Threading
Public Class Main
Private Sub btnBrowse_Click(ByVal sender As System.Object, e As System.EventArgs) Handles btnBrowse.Click
OpenFileDialog.ShowDialog()
tbFile.Text = OpenFileDialog.FileName
End Sub
Private Sub btnUpload_Click(ByVal sender As System.Object, e As System.EventArgs) Handles btnUpload.Click
Dim thisFile As FileInfo = New FileInfo(tbFile.Text)
Dim ITC As Type
Dim parameter() As Object = New Object(1) {}
Dim ITCObject As Object
ITC = Type.GetTypeFromProgID("InetCtls.Inet")
ITCObject = Activator.CreateInstance(ITC)
parameter(0) = CType(tbRemoteServer.Text, String)
parameter(1) = CType("PUT " + thisFile.FullName + " /" + thisFile.Name, String)
ITC.InvokeMember("execute", BindingFlags.InvokeMethod, Nothing, ITCObject, parameter)
End Sub
End Class[/code]
is there anyone could help me to resolve this problem.
Thx,
Phann