Click to See Complete Forum and Search --> : Controlling the Focus


J Fowler
October 2nd, 2001, 08:34 PM
How can one manually point the focus to a specific object without using sendkeys tab. I want to be able to return to a specific field no matter what method a user chooses to reset the form.

~~~~~~~~~~~~
James Fowler

Cakkie
October 3rd, 2001, 02:17 AM
You can use the SetFocus method of a control to give that control the focus

SomeControl.SetFocus




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

Iouri
October 3rd, 2001, 07:13 AM
You can use SendMessage API.

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Private Const WM_SETFOCUS = &H7


Call SendMessage(HandleOfYourObject, WM_SETFOCUS, 0, 0)


Iouri Boutchkine
iouri@hotsheet.com