Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to store active control 1

Status
Not open for further replies.

georg59

Programmer
Sep 1, 2001
26
DE
Hello to all,
I like to write some code to refresh a grid after moving the cursor.
I have a form with some textboxes and a grid that shows all records of the table. Also I have a toolbar with buttons for SKIP -1 and SKIP 1. After a SKIP I like to move the record pointer at the correct position in the grid, and after that the focus must be at the actual textbox:
[tt]
ThisForm.Grid1.SetFocus()
ThisForm.Textbox1.SetFocus()
[/tt]
Now my problem is, that I like to have this code in my toolbar-buttons, but I didn't know how to keep the actual textbox that has the focus.
I can use:
[tt]
lcActiveFocus=thisform.ActiveControl.Name+".SetFocus()"
ThisForm.Grid1.SetFocus()
ThisForm.&lcActiveFocus
[/tt]
But I like to have code that works also, when the textbox is on a page of a pageframe or in a container. Then my code won't work :(
Does anyone have a better idea without writing hundred lines of code? I know, I could check the parent property of the active control, but perhaps there's a better way.

Georg Nickel
Software Development
Germany

 
Thank You Rick, [thumbsup2]
this is what I was looking for.
It works very fine.

Sometimes the fox is more convenient we expected.

Georg Nickel
Software Development
Germany

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top