|
-
Nov 17th, 2011, 11:19 AM
#1
Thread Starter
Junior Member
[RESOLVED] .Focus() Timing Issue
On the left half of my screen I have a datagridview. On the right half I have a document preview pane. As I change rows on the left half, I use the CurrentCellChanged event to open the document associated to that row in the previewer. This works fine, however, the focus is then placed in the preview pane which prevents the user from being able to use the arrow keys to step down a row at a time.
To combat this, I made the final event in my CurrentCellChanged routine set the focus back to my datagridview. Unfortunately, even this doesn’t always work because of what seems to be a timing issue. If the document to be previewed takes more than a fraction of a second to open, the code to move the focus to the datagridview is executed but after the image completes drawing, the focus is moved back to my previewer.
Any ideas? I don’t want to use a timer to force a delay and a DoEvents causes me some other issues. Is there some other event I can use to determine when my preview pane is complete and then and only then set the focus back to my datagrid?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|