-
Contributor
30 Answers
- Posted on Jul 23, 2010
Re: How to disable command button in visual basic
tep 1
Open Visual Basic and select "Standard Exe" to create a new project.
Step 2
Add a button by clicking the square button tool on the right, and then clicking and dragging in the main window.
Step 3
Click the button once to open the "Properties" window on the right. Select the "(Name)" property, and type "myCmdButton" as the name.
Step 4
Double-click the button to open up the code-view window. Type the following in the white space under "Private Sub myCmdButton_Click()":
myCmdButton.enabled = False;
Step 5
Click the blue "Run" button on the top toolbar of Visual Basic. Because you set enabled to "false" in the previous step, you will see your button grayed out, and nothing will happen when you click it.
×