See if this gives you some ideas.
I'd caution you against doing it though - it'll probably annoy your application's users at some point!
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi , I want to disable or modify the event for the all the seven textboxes in my form , in which when the cursor is already on any textbox ( there are seven textboxes on a form ) and in between if the user by using mouse ( only mouse ) tries to get into another textbox , he should be unable to do so . Is there a event which can cancel this .
See if this gives you some ideas.
I'd caution you against doing it though - it'll probably annoy your application's users at some point!
After thinking about this my opinion is to not go in this direction as it can make the user frustrated along with a non-standard path to do data entry. A more conventional approach is to allow the user to enter data in any order they choice then validate which is how web applications do. If open to this I have an article with source code to show how to do this for Windows Forms projects.
Yes this goes against what you are after but it's the better method.
Window forms data annotation. Sample screenshot from article.
Hi @rahul kumar ,Welcome to Microsoft Q&A.
If you want to hide cursor in custom textbox.
You can do this.
[DllImport("user32.dll")]
private static extern bool HideCaret(IntPtr hWnd);
protected override void OnGotFocus(EventArgs e)
{
base.OnGotFocus(e);
HideCaret(Handle);
}
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.