Search code examples
c#bunifu

Why does Bunifu controls shows error on this.Close()


Goal:

I have a simple goal, close the form.

Code:

This is Bunifu button:

enter image description here

private void cancelBtn_Click(object sender, EventArgs e)
{
    this.Close();
}

This is normal button:

enter image description here

private void normal_Click(object sender, EventArgs e)
{
    this.Close();
}

Detail:

This is what happens when clicking the normal button:

Form closes without errors.

Whereas, clicking the buniful button shows me this error:

enter image description here

Question:

Why does the Bunifu button throws me this error? I have not got a clue to what the error means. How can it be fixed?


Solution

  • I think that happens because bunifu buttons have some methods after closing the form like change color on hover etc.

    You may try this below codes

    private void bunifuFlatButton1_Click(object sender, EventArgs e)
    {
    bunifuFlatButton1.Enabled = false;
    this.Close();
    }