msflexgrid control on a form

Posted on 2001-08-28
Last Modified: 2008-04-01
I've got a msflexgrid control with about 5 fields on a vb form.  When I click into the flexgrid control, I can't tab through the fields specified.  It tabs right out to the next tabstop on specefied on the form.

Is there a way I can tab through that flexgrid and then after the last tab in the flexgrid, tab through the rest of the form?

Question by:graflunds
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6433947
there is no built-in function for the flexgrid to allow this kind of operation, using that to iterate from the cells.

Using the keyup and keydown events you cannot do it also because VB doesnt catch the <TAB> in these events.

If you really need to do that, you may want to check ark's code, which is a SyshookDLL file that will allow you to catch every keystroke sent to the form.

With that, you can check with is the cell you are into, and when the user tabs until the last cell, sent it to the next tabstop.

hope this helps...

(download from

Expert Comment

ID: 6434847
a local hook into the keyboard messaging system is the only way to achieve the result you are after. has a good hook dll with source code, and O'reilly has a book "Subclassing and hooking with visual basic" that looks pretty good too.


Expert Comment

ID: 6435102
hi jer
most experts do not propose answers unless you are pretty sure the are the solution, it's better to post as a comment so the question is not locked and is available to the rest of the experts as an open question.
Check to be more clear.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 6435188
hey krees,

thanks for the info... I thought that I was providing a solution, didn't realize that the answer involved actual source code.  Anyway, I will try to limit my responses... again thanks for the input.

Expert Comment

ID: 6435336
There is no built in function to do this.
This is indirectly possible by placing a textbox with the same coordinates as a cell using left and top properties and make the border of the textbox as none. on th lost focus event of the textbox shift the coordinates of the textbox to the next cell and get the focus to that textbox in the next cell.


Author Comment

ID: 6436394
The problem I'm having is I've created this flexgrid from a separate vb project, and made it an activex (ocx) control.  When I run just the separate activex control, the tabs work.  But when I add the control into the form of my main VB project, it tabs right out.  

I've downloaded the syshook file, but am unsure how to use it?

Any help?



Expert Comment

ID: 6438899
hi jer,

sorry to disturb u at this moment.from the question that u have posted i guess u must be involving grids.Presently i had a hard time using grids cos currently i'm doing a search fundtion where all the result have to be presented in grids format erm do u have any idea how the result can be presented in grid or table format.Sorry to ask u a qns here....

Does anyone Knows how to solve this Qns....?
Will be very Grateful to all of u Thanks a million......


Accepted Solution

bhh earned 50 total points
ID: 6438954
If I understand the question right, I have done this.

I have a flexgrid on a form with four columns of data. When you tab into the grid, you are automatically positioned into the first cell of the first row.  Upon entry, I make visible a text box for the user to change the data.  When the user tabs out of the text box, he is positioned at the second box on the first row.  Again, a box is made visible for data entry (although in my case this is a combobox).  The last cell of a row tabs to a hidden box, which updates the grid/tabindex to point to the first cell of the next row (actually to the text box).
Although it appears that the user is tabbing from cell to cell in the grid, they are actually tabbing from dataentrybox to dataentrybox, with the changes being reflected in the grid.  Shift-tabbing also works, as does mouse clicks.  There are only four dataentryboxes (+1 hidden), regardless of the number of rows in the grid.

If this is what you're looking for, let me know.  I can post source code, but it is kind of long.

Expert Comment

ID: 6697173
If this proposed answer has helped you, please accept it, grade it and close this question.  If it did not, reject it and add comments as to your progress and what else is needed.  If no action is taken here by next week, we'll need to decide this outcome.  Expert input always welcome as well.

Community Support Moderator @ Experts Exchange

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question