Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have windows form which is about employee personal data.I want to add data after filling all text boxes of the windows form.
Posted
Comments
Eduard Keilholz 24-Sep-13 4:50am    
This is not a question

Do validation for all the controls before saving.
 
Share this answer
 
Comments
Orcun Iyigun 24-Sep-13 6:38am    
So how do you relate that from the question???
ArunRajendra 24-Sep-13 6:39am    
I mean check all the controls are not empty before saving.
Try this to check if TextBox1 or TextBox2 are empty . If there are not save them.

 if ((String.IsNullOrEmpty(TextBox1.Text)) || (TextBox1.Text == "0")||(String.IsNullOrEmpty(TextBox2.Text)) || (TextBox2.Text == "0")|| etc...)
            {
                string Msg = "<script>alert('The textbox cannot be empty or zero!');</script>";
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "alert", Msg, false);
            }
            else
{
//here put your code
}
            {
 
Share this answer
 
v2
Comments
Orcun Iyigun 24-Sep-13 6:40am    
As the OP said it is windows forms. Why not use the MessageBox instead?
Diana Tsax 24-Sep-13 6:48am    
Orcun Iyigun you are right, sorry i missed it..But the main idea is the same.
sachinthasri 26-Sep-13 23:21pm    
why should I have to use msg box.I already not ticked the allow null check box.is It not enough.

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