I'm trying to clear an error Provider whenever a public static int entry variable is put to 0 ( this variable is static because I'm changing it's value from another form like this :
private void Profile_FormClosing(object sender, FormClosingEventArgs e)
{
this.Hide();
Form1.entry = 0;
}
)
So in my Main Form I setting that entry variable to 1 when I press a button like this:
private void button21_Click(object sender, EventArgs e)
{
if((TransferHair!=String.Empty)&& (TransferName != String.Empty))
{
if (entry == 0)
{
Profile pro = new Profile();
pro.Show();
entry = 1;
errorProvider1.Clear();
}
else
{
//MessageBox.Show("You can't open more than 1 profile box!");
errorProvider1.SetError(button21, "Close the previous profile before opening another!");
}
}
}
But I do want to Clear that error immediately when the Profile form is closed and I am doing this:
private void entry_ValueChanged(object sender,EventArgs e)
{
if (entry == 0)
{
errorProvider1.Clear();
}
}
And it doesn't work!
I did this too:
public int TheEntry
{
get { return entry; }
set
{
if(entry == 0)
{
// entry = 0;
errorProvider1.Clear();
}
}
}
Still not working!
I need a solution please!