Solved

TAB key with  DataGrid Control

Posted on 2000-04-28
13
353 Views
Last Modified: 2013-12-25
What I need:
The Datagrid is 2nd in the Tab Sequence.


It seems that the cursor goes somewhere.
When I hit Tab again,  the correct object is in the next sequence.
But, when the datagrid is supposed to have focus,  I CAN'T see the cursor.


The datagrid is unbound.
I can mouse to the grid.


DataGrid2: settings
TabIndex2
TabStop  =  true
TabAction- =  Have tried all

Any help?
fordraiders
0
Comment
Question by:fordraiders
[X]
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
  • 9
  • 3
13 Comments
 
LVL 32

Expert Comment

by:bhess1
ID: 2760021
Recommendation:  When the .Gotfocus event fires on your grid, set highlighting on the current row.  Your cursor will be visible then.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2760220
bhess1,
Set highlighting?

When I used the mouse cursor to the firstRow , firstCell. and then proceeded to use the tab key ,
When I cycled back around to the grid It then obtained  focus.
However,
When I reached the last cell I got an error message.
"IRowOffset would position you past either end of the rowset, regardless of the cRows value specified; cRowsObtained  is 0"
Thanks
fordraiders

0
 
LVL 3

Author Comment

by:fordraiders
ID: 2760287
bHess1,
When I add a record to the Datagrid(which is what I'am trying to do at this point) . How do I set focus to the row that has the   * as indicating a new record?
Thanks
fordraiders
0
Technology Partners: 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!

 
LVL 32

Expert Comment

by:bhess1
ID: 2760413
The easiest way would be to trap that error you got (IRowOffset), and add a new row to the grid at that point (DBGrid1.Rows = dbGrid1.Rows+1), then set focus to the new row (DBGrid1.Row = DBGrid.Rows - 2 ' if * line displayed - if not, then use -1)
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2760684
bHess1,
I donot have a DBGrid.
I have a datagrid.
fordraiders
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2760721
bHess1,
I donot have a DBGrid.
I have a datagrid.
fordraiders
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2761023
bHess1,
I have had success(but not complete) so far with the following:

Private Sub DataGrid2_GotFocus()
IF (DATAGRID1.SELBOOKMARKS.COUNT <> 0 THEN
DATAGRID2.SELBOOKMARKS.REMOVE 0
END IF

IF ADODC3.RECORDSET.RECORDCOUNT = 0 _
AND DATAGRID2.ROW = 0 THEN
IF ADODC3.RECORDSET.RECORDCOUNT = 0 _
AND DATAGRID2.ROW = -1 THEN
Datagrid2.selBookmarks.add _ DATAGRID2.BOOKMARK
END IF
END IF
END SUB

I still have to right arrow but, I'am getting there.

If could simulate a LeftMouse click  AND a Left Arrow Keystroke  in the datagrid in a cell,  I could have it made.

fordraiders
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2766303
Whoops! Datagrid (off MS Chart object), *NOT* DBGrid!   Bad Brendt, BAD Brendt! :)

I'll take a look, though.  Be back with any ideas...
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2766336
bhess1,
I put a simple sendkeys "{right}"
In the got focus event.
This works o.k. for the first Tab around the form.
When it cycles back the cursor advances to the second cell.

This leads me to believe that after I use the right arrow the first time and then cycle back around the form THEN THE DATAGRID OBTAINS FOCUS WITHOUT CODE.  "Yes" This is what happens.

So when I use code the Datagrid on the second cycle Tabing ,  gives Focus to the second cell because it is already advancing to the first cell automatically.
????????
Hope this makes sense.!

fordraiders


0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 2788089
fordraiders, this might work, in the gotfocus event of datagrid2 put the following instead of the sendkeys stuff:

With DataGrid2
    .Row = .ApproxCount
    .Col = 1
    .EditActive = True
End With

This should position the cursor in the "*" row in column one with the cursor showing.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2788585
Tim,
Works o.k.
How about Datagrid1 AND Datagrid3 Where a new record ISNOT allowed?
Thanks for looking at this question!!!
fordraiders



0
 
LVL 3

Author Comment

by:fordraiders
ID: 2839270
Tim,
This does not work when adding a new record.?
fordraiders
0
 
LVL 3

Author Comment

by:fordraiders
ID: 2849803
Comment accepted as answer
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 192
Put text in a picture ASP.NET C# 2 68
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 66
Help me. 3 69
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

756 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