|
When using dockable forms that contain various controls, users often require the ability to set focus to a control within that form. This functionality is possible. However, you must ensure your form is completely loaded before you can set focus to the control using the SetFocus method. Option Explicit
...
Private Sub Form_Load()
Dim f As New frmHosted
'Host an instance of a form on ourband
Me.ab.Bands("theBand").Tools("theForm").Custom = f
'Show the host form
Me.Show
'Allow our hosted form to be loaded
DoEvents
'Set focus to a textbox on our hosted form
f.txtTest.SetFocus
End Sub
The attached samples (one for version 2 and one for version 3) demonstrate the use of the code above to set focus to a text box control on a dockable form.
Applies To: ActiveBar 2.0 ActiveBar 3.0
|