Hello, i've a problem with this function. Error = errorProvider
public bool IsEmpty { get; set; }
public void CheckEmpty(List<TextBox> txt)
{
foreach (TextBox t in txt)
{
if (t.Text == string.Empty)
{
IsEmpty = true;
error.SetError(t, "Error");
}
else
{
error.Clear();
}
}
if (IsEmpty == true)
{
MessageBox.Show("Eror!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button2_Click(object sender, EventArgs e)
{
List<TextBox> txt = new List<TextBox>() { textBox1, textBox2 };
CheckIsEmptyPart(txt);
}Now, when I write some in textBox1 and texBox2 - is ok - no error. When textbox1 and textbox2 is empty - is ok, shows up Error Text, but now when I write some in textboxes - Icons errordisappear and shows up again Error Text,although textboxes doesn't empty. How can Ichange thefunction thatwas ok?
Thanks