Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Issues with displaying a .Net Form as Child of a MDI Form in VB6 Application

97 views
Skip to first unread message

Splat

unread,
Oct 21, 2005, 5:57:07 PM10/21/05
to
Hi everyone,

I am calling a .Net form from a VB6 MDI application, and want the .Net
form to behave exactly like VB6 MDI child form.

After doing some more research on the net, I could display the .net
form as child of the VB6 MDI form using some winapi functions like
SetParent().

After calling SetParent() the .Net form appears within the MDI form,
but the forms Tab Keys and Arrow Keys do not work. That is, I am able
to type values in to the textbox but cant move to the next textbox
using the Tab key

Does anybody know about a work-around for this?
Or, Am I using the right approach to make a .Net form behave as VB6 MDI
Child form in a VB6 application?
Any help in this regard will be greatly appreciated ... thanks in
advance.

Best regards,
Spark

Karl E. Peterson

unread,
Oct 21, 2005, 6:09:46 PM10/21/05
to
Splat wrote:
> Hi everyone,
>
> I am calling a .Net form from a VB6 MDI application, and want the .Net
> form to behave exactly like VB6 MDI child form.
>
> After doing some more research on the net, I could display the .net
> form as child of the VB6 MDI form using some winapi functions like
> SetParent().
>
> After calling SetParent() the .Net form appears within the MDI form,
> but the forms Tab Keys and Arrow Keys do not work. That is, I am able
> to type values in to the textbox but cant move to the next textbox
> using the Tab key
>
> Does anybody know about a work-around for this?

Best workaround is to not mix VB with VB.NOT -- especially like this. SetParent has
*never* worked to transform a "regular" form of any sort into an MDI child form.
Just doesn't work that way.

> Or, Am I using the right approach to make a .Net form behave as VB6
> MDI Child form in a VB6 application?

Nope. I'd have to recommend not mixing oil and water, here.

PS... Signed the petition, yet?
--
Working Without a .NET?
http://classicvb.org/petition


Ken Halter

unread,
Oct 21, 2005, 6:14:00 PM10/21/05
to
"Splat" <Spla...@gmail.com> wrote in message
news:1129931827....@f14g2000cwb.googlegroups.com...

> Hi everyone,
>
> I am calling a .Net form from a VB6 MDI application, and want the .Net
> form to behave exactly like VB6 MDI child form.

You'll probably fail miserably <g> VB6 MDI Parents refuse to adopt children.
Period.

> After doing some more research on the net, I could display the .net
> form as child of the VB6 MDI form using some winapi functions like
> SetParent().

SetParent won't give you the MDI Child form functionality.

> After calling SetParent() the .Net form appears within the MDI form,
> but the forms Tab Keys and Arrow Keys do not work. That is, I am able
> to type values in to the textbox but cant move to the next textbox
> using the Tab key

That's one of the side effects of SetParent.

> Does anybody know about a work-around for this?
> Or, Am I using the right approach to make a .Net form behave as VB6 MDI
> Child form in a VB6 application?

MDI Parent forms are very stubborn. They only treat MDI Child forms that are
part of the same project as children. There's nothing that can be done about
that except.....

The usual way people do this kind of thing is add a real MDI Child form to
the project and then load a custom OCX that represents a form onto that real
child. I'm not sure about .Net but in VB, this method works well because
Usercontrols are really just a specialized form. All code you can place in a
form can work in a VB6 OCX (more or less... there's no Form_Load or similar
in an OCX but it has equivalent events)

So, if you can convert that DLL into a Usercontrol that VB can load at
runtime, and load that onto a real child form, you'll be set.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..


Ken Halter

unread,
Oct 21, 2005, 6:30:30 PM10/21/05
to
"Karl E. Peterson" <ka...@mvps.org> wrote in message
news:uJCQnwo1...@tk2msftngp13.phx.gbl...

>
> Best workaround is to not mix VB with VB.NOT -- especially like this.
> SetParent has
> *never* worked to transform a "regular" form of any sort into an MDI child
> form.
> Just doesn't work that way.
>
>> Or, Am I using the right approach to make a .Net form behave as VB6
>> MDI Child form in a VB6 application?
>
> Nope. I'd have to recommend not mixing oil and water, here.
>
> PS... Signed the petition, yet?
> --
> Working Without a .NET?
> http://classicvb.org/petition

Sheesh... that's twice you beat me by just a minute or two <g>... heck...
I'm gonna set my clock ahead a few minutes ;-)

Karl E. Peterson

unread,
Oct 21, 2005, 6:57:18 PM10/21/05
to
Ken Halter wrote:
> Sheesh... that's twice you beat me by just a minute or two <g>...
> heck... I'm gonna set my clock ahead a few minutes ;-)

Works for me! <gd&r>

Splat

unread,
Oct 22, 2005, 12:34:33 AM10/22/05
to
Thanks Ken and Karl for the great advice. I agree that the SetParent()
method would not be the right way to go.

Looking at the number of forms that will be needed to integrate, I am
not sure if I want to go the custom control group either.
Nevertheless, Ken, can you point me to some examples\resources\links to
custom control approach you mentioned that can be used in VB6? It would
be good for me to be aware of this trick, as you never know, when I may
need it!

Thanks again guys, appreciate your feedback.
Spark

Schmidt

unread,
Oct 22, 2005, 6:41:43 AM10/22/05
to

"Splat" <Spla...@gmail.com> schrieb im Newsbeitrag
news:1129955673.3...@g47g2000cwa.googlegroups.com...

> Looking at the number of forms that will be needed to integrate, I am
> not sure if I want to go the custom control group either.

At least for the conversion from VB6-MDIChildForms to VB6-OCXs, there is no
big effort (we talk about minutes).
In this thread: http://tinyurl.com/9bb2x ...
... I was describing a todo-list and some of the side-effects.

Olaf


0 new messages