The button only disables after I click on it. I want it to disable without any interaction as soon as the value in the NumericUpDown control is incremented above a specific point. I have goggled but found no answers, here is my code:
private void mybtn_Click(object sender, EventArgs e)
{
if (numericud.Value > myArray[r, c] || myArray[r, c] == 0)
DisableButton(mybtn);
myArray[r, c] = CalcNewMax(myArray[r, c]);
OpenNewForm();
}
private void DisableButton(Button selectedbtn)
{
selectedbtn.Enabled = false;
}
Any help is much appreciated, thanks!
mybtn.Enabled = false;is executing. It would be clearer if you surrounded that line of code with braces.