Determine If Changed Event Occurred from User Input Or Not

后端 未结 6 818
借酒劲吻你
借酒劲吻你 2021-01-18 00:38

In C#, the Changed event for a control (say, a numericupdown) gets fired whether the value was change directly by the user or if it was changed programatically as the result

6条回答
  •  离开以前
    2021-01-18 00:57

    There is no nice way to do it. You can find workarounds for specific cases, e.g.

    • listen to MouseDown or something instead of valueChanged on the numeric drop down.

    • Set a flag in button click event handler that will prohibit the message box from showing.

      In general you should try to organize your form in a way that it doesn't matter where the value got changed.

提交回复
热议问题