General information
Category:
Forms & Form designer
>1) Make the cursor (focus) go to a certain field by means of pressing a key like F2, but only while I am in a given form?
>I tried an ON KEY LABEL F2 thisform.thisfield.setfocus
>but got a message saying thisform can only be used within a method.
>
>2) I have several combo boxes in a form and I'd like them to display (open) automatically when getting the focus. I'm looking for an equivalent SendKeys command in Visual Basic, but can't find any.
>
>Thanks in advance.
>Ulises.
About the F2 :
Probably 'thisform' can only be used if you are executing method of a form. Then 'thisform' refers to the form of which the code is being executed.
You could try : ON KEY LABEL F2 MyForm.FieldWhatEver.SetFocus
Or better yet, execute a function, or a method from the form, that first checks if MyForm is active or not, because otherwise the SetFocus method will give an error.
You could also set the KeyPreview property of the form to TRUE, and check if F2 is pressed in the KeyPress event.
About the combo's, I have no idea.
Regards,
Marc
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only