VB。网络按钮第二次点击

时间:2017-10-14 13:38:53

标签: vb.net vb.net-2010

首次点击时,我想看到列表框,并禁用了一些按钮 在第二次单击时,我希望再次启用列表框和按钮。

我目前的代码是:

 
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles Button2.Click
    lstbx_1.Enabled = False
    lstbx_2.Enabled = False
    outbtn.Enabled = False
    Button2.Text = "remove approval"
End Sub

1 个答案:

答案 0 :(得分:1)

试试这段代码:

 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        lstbx_1.Enabled = Not (lstbx_1.Enabled)
        lstbx_2.Enabled = Not (lstbx_2.Enabled)
        outbtn.Enabled = Not (outbtn.Enabled)

        If lstbx_1.Enabled = False Then
            Button2.Text = "remove approval"
        Else
            Button2.Text = "Your Text"
        End If

    End Sub