Click here to Skip to main content
15,909,898 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I have five textboxes that i want users to fill before clicking the save button.

I need a code that will tell them if any of those textbox are empty.
Posted

Use string.IsNullOrEmpty or use a validator. This is a trivial task, you should consider buying a book on Winforms.
 
Share this answer
 
PLease don't push 'answer' to add comments. Edit your post. If you don't want to use a validator, the code to write instead is obviously trivial, which is why I suggest you also buy a book to help you understand the basics of how winforms works. There are events, such as the event fired by your save button. You can write code to run, and you can access and check the Text property of your textboxes. A validator does all this for you, but it's not hard to write yourself.
 
Share this answer
 
Just add the code to your button click event for the save button. If any of the boxes do not contain (valid) entries then pop a message to alert the user. I'm not a C# expert (and I don't have a compiler on this PC to check) but I am reasonably sure there are also some events linked to the text boxes that would allow you to disable the Save button until all boxes contain valid entries.
 
Share this answer
 
hi,

You will find your solution in the link below,
http://asp.net-tutorials.com/validation/required-field-validator/[^]

Hope this will help...
 
Share this answer
 
Thanks,

I don't want to use required field validator.
 
Share this answer
 

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