Home
Online Free Visual Basic Course

Learning Visual Basic online

Learning VB 6

In the 'Essentials' topic Learning Visual Basic, a program that uses one form with two command buttons was introduced.

We're going to go through the complete steps to create this.
First ... in rapid fire ... the steps.
Then ... a more complete explanation.

  1. Start Visual Basic. Usually, 'Start > Programs > Microsoft Visual Studio > Microsoft Visual Basic 6.0'.
  2. Click the default Standard EXE icon and then click the Open button.
  3. Click the Command Button icon in the Toolbox. Draw two buttons on the form by clicking and dragging.
  4. Click the first Command Button to select it. Open the property window and change the Name property to CommandA. Change the Caption to A.
  5. Select the second Command Button from the drop down window at the top of the property window and then change the Name property to CommandB. Change the Caption to B.
  6. Double click the first Command Button object in the form to open the code window for that button.
  7. Enter the code, Msgbox "You clicked Button A" after the automatically entered code Private Sub CommandA_Click().
  8. Double click the second Command Button object in the form to open the code window for that button.
  9. Enter the code, Msgbox "You clicked Button B" after the automatically entered code Private Sub CommandB_Click().
  10. Click the Run button in the toolbar at the top of the VB 6 development environment window to execute the program.
  11. Click either button A or button B and observe the fruits of your labor!


Administration

Tanvir Shah
S. Tavnir Hussain

Principal

Tauqeer Hussain
Tauqeer Hussain

Faculty Incharge

Safi Ullah
Safi Ullah Khurum

Admin