PDA

Click to See Complete Forum and Search --> : Shortcut Keys!


formalejo
Jul 13th, 2001, 08:53 PM
How can we use the Lost Focus event of the Text box by using the shortcut keys from the command button?

Senario: Cursor is Parked to the TextBox
Case 1. Click the CommandButton, the LostFocus event from the TextBox will be validated. - OK!

Case 2. Press Alt+(Letter) from the CommandButton, the LostFocus event from the TextBox will not be validated. It will move directly to the CommandButton's code. - Not OK!

Case 3. Putting the LostFocus event inside the CommandButton Click event is not applicable. - Dont use this code!
e.g.
Private Sub CommandButton1_Click()
TextBox1_LostFocus
Msgbox "Record Saved!"
End Sub()

Please Help! your answers will be highly appreciated!

Thanks,
Franz
+639198505203

Serge
Jul 22nd, 2001, 07:22 PM
The LostFocus event happens when the control looses focus. So when click your button the event will fire if you have the focus in the TextBox. Second, if you want to assign a shortcut for that particular textbox, then use KeyUp or KeyDown event in the TextBox and simply set the focus to the command buton.