2016-08-15 2 views
0

이 코드를 더 간단하게 만들 수 있습니까?C# numericUpDown time validate

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 
} 

답변

0

업데이트 1 : button3은 실제로 OP의 질문에서도 ok 버튼이어야합니다. 업데이트 2 :이 내가 원하는 것을 가정하고

타이머입니다 :

  • OK 버튼이 활성화을 할 때 시간> 0 또는 분> 0

시도 :

okButton.Enabled = hourNumericUpDown.Value > 0 || minutesNumericUpDown.Value > 0; 
+0

Soo 미안하지만 실제로는 ok 버튼도 있습니다 :) 어쨌든 thx –

+0

OK great - up 대답의 기한은 –

+0

입니다. || 대신에 &&? –