Is it possible to make this code simpler?
private void hourNumericUpDown_ValueChanged(object sender, EventArgs e)
{
if (hourNumericUpDown.Value == 0 & minutesNumericUpDown.Value == 0) { okButton.Enabled = false; } else okButton.Enabled = true;
// same in minutesNumericUpDown's event
}
Update 1: button3 should actually be okButton too in OP's question. Update 2: this is a timer
I am assuming that you want:
Try:
okButton.Enabled = hourNumericUpDown.Value > 0 || minutesNumericUpDown.Value > 0;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.