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
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
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..
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>
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
> 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