Interop UserControls provide a basic set of intrinsic events (Click, GotFocus, Validate, etc.) in Visual Basic 6.0. You can define your own custom events in Visual Studio .NET and raise them using standard C# syntax. In order to handle the events in Visual Basic 6.0, simply add the Interop UserControl to your form and set up the events as you would with any native VB6 control.

Contrary to the documentation that comes with the VB version of the toolkit, it is no longer necessary to add a project reference and add a WithEvents variable declaration in your code, and then handle the events using the WithEvents variable rather than the control itself. This was a problem when the toolkit was initially released to work on .NET Framework 2.0 and Visual Studio 2005, but it has since been resolved in the .NET Framework 2.0 SP1 and also in the .NET Framework 3.5 (as confirmed in a Channel 9 video featuring Todd Apley from Microsoft).

Last edited Jan 16, 2012 at 5:21 AM by HolisticDeveloper, version 1


No comments yet.