?
Solved

Editing MSFlexgrid with TextBox, Problem with Keeping Focus on TextBox

Posted on 2006-06-29
6
Medium Priority
?
1,165 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 

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 2000 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

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!

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans
Suggested Courses

777 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