Events Needs to update again and again in VB6 from .Net User control


I have created a textbox user control in .Net using interop, When I am using it in VB6, events need to be update again and again.

For example :

In .Net user control:

I have declared event and used it as:

Public Event Change As EventHandler

Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    RaiseEvent Change(Me, e)
End Sub

In VB6 code :

Private Sub TextBox1_Change(ByVal sender As Variant, ByVal e As mscorlib.EventArgs)
Dim Stext As String

Stext = ""
End Sub

When I use it in VB6 code, initially it works fine. But If I Restart the project again, and Compile the project, it gives an error, "User-defined type not defined", Higlighting the event.

If delete the event and again create the same event, it works fine. It happens to me again agin.

There might be some problem with "ByVal sender As Variant, ByVal e As mscorlib.EventArgs".

Please Help.


Closed Nov 9, 2013 at 2:05 AM by HolisticDeveloper


HolisticDeveloper wrote Nov 9, 2013 at 2:03 AM

It looks like your .NET code is actual VB.NET and not C#, so I'm assuming that your problem is with the Microsoft-released templates for VB, and not the templates here for C#. Your best bet would be to post to the VB.NET Interop forum.

However, if you can reproduce this problem with the C# templates, please post some sample code.

wrote Nov 9, 2013 at 2:05 AM

wrote Nov 9, 2013 at 2:05 AM