Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Hi
I have three TextBoxes in C# Windows Application and one Button.
If user clicks a Button then I check if any TextBox is empty, then I use
MessageBox.Show("You cannot use a blank TextBox") and after automatic set focus in blank TextBox
I do this but I do not set focus in blank TextBox. So what do I need to do?
Please help me

Thanks in advance

[Modified: removed capitalization on the first letter of every word and tried to make it more readable.]
Posted
Updated 25-Mar-10 6:40am
v2

this.textBox1.Focus();
 
Share this answer
 
Do you really need to show a messagebox.
Is the purpose of messagebox is just to convey the error/warning, if Yes then I think you can use errorprovider control.
Try these links:
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900