G
Guest
Okay i manage to convert the C# class library into dll, and enable com interop.
I basically can call c# methods from vb6 with this as long i add references to the .net project (e.g TestProject)
Private Sub Command1_Click()
Dim myObject As TestProject.ClassA
Set myObject = New TestProject.ClassA
Dim test as String
test = myObject.PrintHello()
MsgBox test
End Sub
in C# if i code this,
public string PrintHello()
{
return "hello";
}
so i can get to call the method from vb6 with the solution on top!
----
But if i use try to use static in the method,
public static string PrintHello()
{
return "Hello";
}
i receive an error in VB6
coz i called directly like
Dim test2 as String
test2 = ClassA.PrintHello() 'fail to work
Compile Error: Variable not defined - cannot find ClassA
Any idea, please?
Thanks.
I basically can call c# methods from vb6 with this as long i add references to the .net project (e.g TestProject)
Private Sub Command1_Click()
Dim myObject As TestProject.ClassA
Set myObject = New TestProject.ClassA
Dim test as String
test = myObject.PrintHello()
MsgBox test
End Sub
in C# if i code this,
public string PrintHello()
{
return "hello";
}
so i can get to call the method from vb6 with the solution on top!
----
But if i use try to use static in the method,
public static string PrintHello()
{
return "Hello";
}
i receive an error in VB6
coz i called directly like
Dim test2 as String
test2 = ClassA.PrintHello() 'fail to work
Compile Error: Variable not defined - cannot find ClassA
Any idea, please?
Thanks.