Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

c# remove focus from text box

Posted on 2011-02-21
3
Medium Priority
?
2,279 Views
Last Modified: 2013-12-17
Hi,

In my form, I have a button, and a list box. Wheneve my form loaded, the cursor is always pointed to text box. How can redirect this cursor so that I can implement keydown process where a user can press space bar or enter key to exit my app?

Thanks,
JT
0
Comment
Question by:jtran007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 34943100
There should be a form property - preview keys, set this to true then add a keydown handler to the form and put your code there to handle space bar (and other keys).

Or just change the tab order so the listbox is the first control if that is suitable for your needs
0
 
LVL 9

Assisted Solution

by:s_chilkury
s_chilkury earned 500 total points
ID: 34943111
The TabIndex property of the textbox is 0. This sets the focus on textbox as soon as the form is loaded.

Set the TabIndex property of any other label to 0 which will serve your purpose.
0
 

Author Closing Comment

by:jtran007
ID: 34943544
Thanks,
JT
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question