MariaHalt
asked on
Editing MSFlexgrid with TextBox, Problem with Keeping Focus on TextBox
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?
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?
Add a code to handle the MSHFlexGrid1_LeaveCell event.
ASKER
I have code in the MSFlexGrid_LeaveCell Event that saves any changes made.
What exactly are you suggesting that I add?
What exactly are you suggesting that I add?
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...
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...
ASKER
Yes, I do both. That's what makes this puzzling.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked! Thank you!!!