开发者

Can't disable the button from executing .BAT

开发者 https://www.devze.com 2023-01-22 07:54 出处:网络
Can anyone explain why my button keeps launching the associated .BAT file every time I click it, even though I have set it to disabled?

Can anyone explain why my button keeps launching the associated .BAT file every time I click it, even though I have set it to disabled?

Private Sub TabPage3_Click(ByVal sender As System.Object, B开发者_运维知识库yVal e As System.EventArgs) Handles TabPage3.Click
    Dim RetBat3

    RetBat3 = Shell("c:\QUEEN ANNES REVENGE\SYSTEM\BAT\UNDO_1.bat", 1)

    Button5.Enabled = False

End Sub


Because that event handler is tied to TabPage3_Click ?

Its not clear what you're trying to do, but you launch the batch file when TabPage3 is clicked, then disable a button control.

You probably want to remove this TabPage3 click and put the handler on the button instead


You could try adding

if (Button5.Enabled)
{
    Button5.Enabled = False
    RetBat3 = Shell("c:\QUEEN ANNES REVENGE\SYSTEM\BAT\UNDO_1.bat", 1)
}

It feels wrong, but based on the little information you've provided it might fix your immediate issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消