VB6/Winforms interop

Check out the Microsoft InteropForms Toolkit 1.0

This toolkit helps you bring the power of .NET to your existing VB6 applications, by allowing them to display .NET WinForms from within the same application. Instead of upgrading the entire code base, these applications can now be extended one form at a time. The goal is a phased upgrade, with production releases at the end of each iteration containing both VB6 and VB.NET forms running in the same VB6 .exe process.

Screencast available here: http://blogs.msdn.com/vbteam/archive/2006/09/23/768719.aspx

Comments (3)

  1. I wonder if this is a bug in ContextMenuStrip. If I dispose menu from OnClosed event, it crashes later in call to ReparentToDropDownOwnerWindow. With reflector I can see, that the call is "guarded" with condition:

    if (this.TopLevel && (!base.IsDisposed || !base.Disposing))


    Shouldn’t they all be && operators??

  2. jfoscoding says:

    I’d replace your call with a call to BeginInvoke(new MethodInvoker(Dispose)), so that Dispose will happen after close has completely cleaned itself up.

    There are several places in the framework where we have this class of "problem" – the most common is folks calling button1.Dispose() from the click event handler.  It’s imperitive in some cases that the object not be in the middle of doing something when you attempt to dispose it.

  3. Ilya Ryzhenkov says:

    I though about it, but in our environment this is not acceptable for several reasons. I ended up overriding SetVisibleCore instead and disposing after base method finished its work, when visible parameter is false.

    Thanks anyway!