Home All Groups Group Topic Archive Search About

Tabbing not working in vb 6.0 forms

Author
11 Apr 2006 5:02 PM
rmiller
I'm in dire straits. I'm converting part of a product into VB.NET, but
still need to access forms written in VB 6.0. I've got just about
everyting working, but the tabbing on the form. The form captures the
tab key when it's pressed, but fails to go through the series of
controls. Help!

Author
11 Apr 2006 6:29 PM
Ken Halter
"rmiller" <CutThroatRac***@gmail.com> wrote in message
news:1144774973.295307.120500@t31g2000cwb.googlegroups.com...
> I'm in dire straits. I'm converting part of a product into VB.NET, but
> still need to access forms written in VB 6.0. I've got just about
> everyting working, but the tabbing on the form. The form captures the
> tab key when it's pressed, but fails to go through the series of
> controls. Help!

Did that form behave correctly from VB6? Are you using any APIs to reset the
Parent of that VB6 form (fwiw, a misbehaved tab key is one of the side
effects of the SetParent API)? You mention that the form traps the tab
key.... how? Normally, in VB6, you can detect Tab only if TabStop = False on
every control on the form. Is this the case? More info please <g>

Thing is, if you set TabStop = False on all controls in that VB6 form, I can
dig up some code that gathers all controls into a collection, sorts them
based on TabIndex and when Tab (or Shift Tab) is pressed, the code figures
out (easily) which control needs to get focus.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Author
11 Apr 2006 11:11 PM
rmiller
Thanks Ken. The form behaves normally when called from another VB6.0
application. I use an API (ShowWindow, i believe) to show the form
because one cannot call a COM non-modal form from .NET app. This makes
it an out of process object and it looses the ability to capture the
Tab key for some reason, so instead it enters the KeyDown routine for
the Form rather than just skipping to the next control. I added some
code to find the ActiveControl and then set the ActiveControl to the
next one in the TabIndex order which seems to work well, but kind of a
hack in my opinon.