Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Focus 2

Status
Not open for further replies.

hanglam

Programmer
Dec 11, 2002
143
US
hi all,

i have a Windows Form with a bunch of texboxes and combobox in it .
When i'm running the app and filling out the form , I want to click on the form itself so no control has the focus . I thought by click on the form itself will make all controls lose the focus , but somehow that is not the case and last control used still has the focus .

is this a bug or am i missing something here , do i need to set a property in the form ?

is there a way to make the form gain the focus so that no controls has the focus ?

thanks,
hang
 
How about setting each control's TabStop property to False?
 
You could add another focusable control and either hide it under another control or move it off the viewable portion of the form. Set it's tab stop to false, and on the form.click even set the focus to your hidden control. Set the hidden control's tab index to 0, so that if your users click the form, then hit tab, they should wind up in the first correct control.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Thanks,

I got the answer from another board.

In the Form_Click event, add this line:
me.ActiveControl = nothing

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top