I have written a code for validating text boxes as follows
public class TestClass
{
public void RequiredText(TextBox txt, ToolTip newtoolTip)
{
if (txt.Text != string.Empty)
{
//txt.Text = "Required";
txt.BackColor = System.Drawing.Color.White;
newtoolTip.Hide(txt);
}
else
{
txt.BackColor = System.Drawing.Color.Tomato;
newtoolTip.Show("Required", txt);
}
}
}
In textbox validating i use this
private void textBox2_Validating(object sender, CancelEventArgs e)
{
TestClass test = new TestClass();
test.RequiredText(textBox2, toolTip1);
}
Now what i need is when i click on submit i would like to display error message for the text boxes that are left empty . If success i would like to save the record. Any idea please
Loading

Dorababu MekaPosted Jun 21, 2010, 9:05 AM
Dorababu MekaPosted Jun 21, 2010, 6:47 AM
CrishPosted Jun 21, 2010, 6:45 AM
If you want to alert message run time then check each textbox not null else insert your values in textbox. If any value is null then set flag is true. Check flag is true then show message else insert values.
thanks