masterK
September 30th, 2005, 02:08 AM
I have created a very simple .NET control with one method and have set the 'Register for COM Interop' build option. I am having problems calling it from VB6.
In the first example I can create the control and it displays in my VB6 project yet I can't call the method on it as I get a VB6 error.
Example 1
Dim aVar As Control
Set aVar = Controls.Add("SimpleClassLibrary.simpleControl", "test")
aVar.Visible = True
aString = aVar.getString
SimpleControl is the .NET control.
In the second example I can create the control and call it's methods, but it does not appear on the VB6 form.
Example 2
dim mSimple As SimpleClassLibrary.simpleControl
Set mSimple = CreateObject("SimpleClassLibrary.simpleControl")
aString = mSimple.getString
Can anybody tell me what I am doing wrong, it's driving me mad at this stage. I want the VB.NET control to appear on the VB6 form and to be able to call it's methods.
In the first example I can create the control and it displays in my VB6 project yet I can't call the method on it as I get a VB6 error.
Example 1
Dim aVar As Control
Set aVar = Controls.Add("SimpleClassLibrary.simpleControl", "test")
aVar.Visible = True
aString = aVar.getString
SimpleControl is the .NET control.
In the second example I can create the control and call it's methods, but it does not appear on the VB6 form.
Example 2
dim mSimple As SimpleClassLibrary.simpleControl
Set mSimple = CreateObject("SimpleClassLibrary.simpleControl")
aString = mSimple.getString
Can anybody tell me what I am doing wrong, it's driving me mad at this stage. I want the VB.NET control to appear on the VB6 form and to be able to call it's methods.