Moving the focus to nowhere.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I seem to remember a method of making the focus move to an invisible button
on a form, making it appear that there was no control with the focus. Can
someone enlighten me on how this is done (or some other method). Thanks
 
Proko said:
I seem to remember a method of making the focus move to an invisible
button on a form, making it appear that there was no control with the
focus. Can someone enlighten me on how this is done (or some other
method). Thanks

Setting focus to an invisible control is not possible. You can however, set
focus to a button or TextBox that is so small that it cannot be seen.
 
Thanks Rick

Rick Brandt said:
Setting focus to an invisible control is not possible. You can however, set
focus to a button or TextBox that is so small that it cannot be seen.
 
As an extension of what Rick has already said, If i need a form to appear to
not have any control that has the focus, I normally use a text box for this
purpose. I create the text box, and name it "txtHoldCursor". I then set its
left positon and its width to zero. This will place the new text box at the
left edge of my form and its with to nothing. I then make this text box the
first contro in the Tab Order of my form. I then use code to set the focus
to this control when I do not want any other control to have the focus.
 
Rick said:
Setting focus to an invisible control is not possible. You can however, set
focus to a button or TextBox that is so small that it cannot be seen.
Make a command button.
Set it to transparent with no caption.

Use this to focus on it.
Me.CommandButton.SetFocus

DS
 
Back
Top