Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Editing MSFlexgrid with TextBox, Problem with Keeping Focus on TextBox

Posted on 2006-06-29
6
Medium Priority
?
1,166 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Starting up a Project
Suggested Courses

618 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