Placing a .NET Form/UserControl inside a VB Form

J

Jim

Hi Group.

I'm trying to place my own windows form or user control inside a VB Form.

My first attempt used the IOleWindow::GetWindow of the VB Form in order
to get its handle. I then used Win32 API SetParent to place my .NET Form
inside the VB Form.

Now the problem is that neither tab stops or accelerator keys work using
this approach :/

Does anyone have a solution to this problem, or alternative ways of
placing my .NET Forms inside the VB Form???

For reference, the VB Form implements the following interfaces that
could provide a solution:

{00000000-0000-0000-C000-000000000046}: IUnknown
{00000019-0000-0000-C000-000000000046}: IExternalConnection
{0000010a-0000-0000-C000-000000000046}: IPersistStorage
{0000010c-0000-0000-C000-000000000046}: IPersist
{0000010d-0000-0000-C000-000000000046}: IViewObject
{0000010e-0000-0000-C000-000000000046}: IDataObject
{00000112-0000-0000-C000-000000000046}: IOleObject
{00000113-0000-0000-C000-000000000046}: IOleInPlaceObject
{00000114-0000-0000-C000-000000000046}: IOleWindow
{00000117-0000-0000-C000-000000000046}: IOleInPlaceActiveObject
{0000011a-0000-0000-C000-000000000046}: IParseDisplayName
{0000011b-0000-0000-C000-000000000046}: IOleContainer
{0000011c-0000-0000-C000-000000000046}: IOleItemContainer
{0000011e-0000-0000-C000-000000000046}: IOleCache
{00000126-0000-0000-C000-000000000046}: IRunnableObject
{00000127-0000-0000-C000-000000000046}: IViewObject2
{00000128-0000-0000-C000-000000000046}: IOleCache2
{00020400-0000-0000-C000-000000000046}: IDispatch
{04598FC8-866C-11CF-AB7C-00AA00C08FCF}: _UserForm
{376BD3AA-3845-101B-84ED-08002B2EC713}: IPerPropertyBrowsing
{55980BA0-35AA-11CF-B671-00AA004CD6D8}: IPointerInactive
{618736E0-3C3D-11CF-810C-00AA00389B71}: IAccessible
{6D5140C1-7436-11CE-8034-00AA006009FA}: IServiceProvider
{9BFBBC02-EFF1-101A-84ED-00AA00341D07}: IPropertyNotifySink
{B196B283-BAB4-101A-B69C-00AA00341D07}: IProvideClassInfo
{B196B284-BAB4-101A-B69C-00AA00341D07}: IConnectionPointContainer
{B196B288-BAB4-101A-B69C-00AA00341D07}: IOleControl
{B722BCC5-4E68-101B-A2BC-00AA00404770}: IOleDocument
{B722BCC6-4E68-101B-A2BC-00AA00404770}: IOleDocumentView
{B722BCCB-4E68-101B-A2BC-00AA00404770}: IOleCommandTarget
{CF51ED10-62FE-11CF-BF86-00A0C9034836}: IQuickActivate
{DF0B3D60-548F-101B-8E65-08002B2BD119}: ISupportErrorInfo
 
H

Herfried K. Wagner [MVP]

Jim,

Jim said:
I'm trying to place my own windows form or user control inside a VB Form.

My first attempt used the IOleWindow::GetWindow of the VB Form in order
to get its handle. I then used Win32 API SetParent to place my .NET Form
inside the VB Form.

Using a VB6 form as host for a Windows Forms control is not supported:

ActiveX control containers that support .NET controls
<URL:http://support.microsoft.com/?scid=kb;EN-US;311334>
 
S

Sue Mosher [MVP-Outlook]

So the potential solution would be to use a web browser control on a VB6
userform and use the browser to host the .Net Windows form or control?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
H

Herfried K. Wagner [MVP]

Sue,

Sue Mosher said:
So the potential solution would be to use a web browser control on a VB6
userform and use the browser to host the .Net Windows form or control?

That will be a supported scenario.
 
Top