我正在按钮上执行代码click事件。当代码评估为true时,它会更改当前按钮控件" .DialogResult"属性为.DialogResult.OK。问题是,当我在这个按钮单击事件中更改此设置时,更改确实不会立即发生 - 即因为按钮已被按下,所以更改了它的属性按下它不具有所需的结果 - 即更改.DialogResult属性是此单击事件。 (.DialogResult.OK属性更改仅适用于下次按下按钮_)。 任何帮助将不胜感激,以了解如何运行代码来更改 .DialogResult属性,以便更改会立即改变按钮的行为。 每当我更改dialogresult属性时,它都会立即更改。 - Armin I have code that I want to run so that if the result is true, it changes thecurrent button''s ".DialogResult" property to "DialogResult.OK". Problem is,when I run this code on the ".Click" event for the current button and thenrun this code, if the ".DialogResult" property is change, it does not takeaffect until the button is pressed again.I do I workaround this? 解决方案Why don''t you execute the code on the first click?--ArminI am executing the code on the buttons "click" event. When the codeevaluates to true, it changes the current buttons control ".DialogResult"property to ".DialogResult.OK". The problem is, when I change this settingin this buttons click event, the change does not take place right away -i.e. since the button was already pressed, changing the property of it afterit is pressed is not having the desired result -- which is to change the".DialogResult" property was this click event. (The .DialogResult.OKproperty change only works for the next time the button is pressed_).Any help would be appreciated to find out how to run code to change the..DialogResult property so that the change would change the behavior of thebutton right away.Thanks. I am executing the code on the buttons "click" event. When the code evaluates to true, it changes the current buttons control ".DialogResult" property to ".DialogResult.OK". The problem is, when I change this setting in this buttons click event, the change does not take place right away - i.e. since the button was already pressed, changing the property of it after it is pressed is not having the desired result -- which is to change the ".DialogResult" property was this click event. (The .DialogResult.OK property change only works for the next time the button is pressed_). Any help would be appreciated to find out how to run code to change the .DialogResult property so that the change would change the behavior of the button right away.Whenever I change the dialogresult property it does change right away.--Armin 这篇关于按钮单击事件的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-07 02:38