Solved

Editing MSFlexgrid with TextBox, Problem with Keeping Focus on TextBox

Posted on 2006-06-29
6
1,163 Views
Last Modified: 2013-11-13
I have a frame with 2 combo boxes, 3 label, 1 command button, 1 MSFlexgrid and 1 textbox.  

When a selection is made in both combo boxes, the MSFlexgrid is populated and appears.  The textbox is used to edit the non-fixed cells on the MSFlexgrid.  It seems to work OK at first, but when I click on another cell, the floating textbox won't keep the focus.  It reverts to the first combo box.  If I use the arrow keys to move to another cell, it keeps the focus.

textbox.TabStop = True (all other controls it's False)

In the MSFlexGrid_EnterCell Event I have the following code that is supposed to secure the focus on the textbox, it runs, but doesn't seem to do it's job all the time.

textbox.ZOrder (0)
textbox.Visible = True
textbox.SetFocus

How can I keep the focus on the textbox when clicked on?
0
Comment
Question by:MariaHalt
[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
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:Mortaza Doulaty
ID: 17027681
Add a code to handle the  MSHFlexGrid1_LeaveCell event.
0
 

Author Comment

by:MariaHalt
ID: 17030299
I have code in the  MSFlexGrid_LeaveCell Event that saves any changes made.  

What exactly are you suggesting that I add?
0
 
LVL 12

Expert Comment

by:Mortaza Doulaty
ID: 17031756
Have you tried this:

Private Sub MSHFlexGrid1_EnterCell()
  Text1.Setfocus
End Sub

Private Sub MSHFlexGrid1_Click()
  Text1.Setfocus
End Sub

In the "Click" event, setting the focus on text1, should solve the problem...
0
Independent Software Vendors: 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!

 

Author Comment

by:MariaHalt
ID: 17032374
Yes, I do both.  That's what makes this puzzling.  
0
 
LVL 12

Accepted Solution

by:
Mortaza Doulaty earned 500 total points
ID: 17033276
Try to add some DoEvents in lines with your code!
Seems funny but may help, for example:

  DoEvents
  Text1.Setfocus
  DoEvents
0
 

Author Comment

by:MariaHalt
ID: 17033310
It worked!  Thank you!!!
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression

695 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