How to Create a Simple Calculator in Visual Basic 6.0

November 2022 · 3 minute read

This wikiHow teaches you how to use Microsoft's Visual Basic 6.0 to create a simple calculator that can add, subtract, multiply, and divide. Keep in mind that Visual Basic 6.0 is no longer used by modern computers, so you'll need to have...

Part 1 of 5:

Creating a New Project

  • Picture 1 of How to Create a Simple Calculator in Visual Basic 6.0 Create a new folder for your calculator. To house all of your calculator's necessary files, do the following:
  • Go to the location in which you want to save your VB6 calculator.
  • Right-click a blank space.
  • Select New in the drop-down menu.
  • Click Folder.
  • Type in Calculator and press Enter.
  • Picture 2 of How to Create a Simple Calculator in Visual Basic 6.0

    Open Visual Basic 6. This will bring up the project selection page.

  • Picture 3 of How to Create a Simple Calculator in Visual Basic 6.0

    Click Standard EXE. It's in the project selection field.

  • Picture 4 of How to Create a Simple Calculator in Visual Basic 6.0

    Click Open. This is in the bottom-right corner of the window. Doing so creates a new project.

  • Part 2 of 5:

    Creating the Calculator's Input Fields

  • Picture 5 of How to Create a Simple Calculator in Visual Basic 6.0

    Open the "Text Box" tool. Click the ab button on the left-hand side of the window.

  • Picture 6 of How to Create a Simple Calculator in Visual Basic 6.0 Create a text box. Click and drag your mouse down and right to draw an outline of the text box, then release the mouse button when the text box is the proper size.
  • Ideally, your text box will be significantly longer than it is tall.
  • Picture 7 of How to Create a Simple Calculator in Visual Basic 6.0

    Copy the text box. Click once the text box to select it, then press Ctrl+C to copy it.

  • Picture 8 of How to Create a Simple Calculator in Visual Basic 6.0 Paste in the text box twice. Press Ctrl+V twice to do so. You should see your pasted text boxes appear in the upper-right side of the page.
  • If prompted to create a new control array after pasting in a text box, click No.
  • Picture 9 of How to Create a Simple Calculator in Visual Basic 6.0 Arrange the text boxes in a stack. Click and drag the text box in the top-left side of the page down to the bottom slot, then move the second text box from the top-left side of the page into the middle slot. You should now have a stack of three text boxes.[1]
  • The order in which you do this is important; if you place the text box you pasted second in the middle, it will cause your coding later to malfunction.
  • Picture 10 of How to Create a Simple Calculator in Visual Basic 6.0 Remove the text boxes' default text. To do so:
  • Click a text box.
  • Click the text field to the right of the "Text" heading in the "Properties" pane on the right side of the window.
  • Press Delete.
  • Repeat with the other two text boxes.
  • Picture 11 of How to Create a Simple Calculator in Visual Basic 6.0 Create three label boxes. Click the A button in the left-hand toolbar, then do the following:
  • Resize the label box to your preferred size.
  • Select the label box, then copy it.
  • Paste twice the label box.
  • Picture 12 of How to Create a Simple Calculator in Visual Basic 6.0

    Place the label boxes to the left of the text boxes. Click and drag each label box to sit to the left of each text box.

  • Picture 13 of How to Create a Simple Calculator in Visual Basic 6.0 Edit the top label box's caption. To do so:
  • Click the top label box.
  • Click the text box to the right of the "Caption" heading in the "Properties" pane on the right side of the window.
  • Type in Number 1.
  • Picture 14 of How to Create a Simple Calculator in Visual Basic 6.0 Edit the other two label boxes' captions. You'll label them like so:
  • Click the middle label box, then change its caption to Number 2.
  • Click the bottom label box, then change its caption to Result.
  • Picture 15 of How to Create a Simple Calculator in Visual Basic 6.0 Make the label boxes transparent. This isn't necessary, but it will make your calculator more visually appealing:
  • Select a label box.
  • Click the "BackStyle" drop-down box in the "Properties" pane.
  • Click Transparent in the drop-down menu.
  • Picture 16 of How to Create a Simple Calculator in Visual Basic 6.0 Title your calculator. To change the text that appears at the top of the calculator's window when you run it, do the following:
  • Click a blank space on the form.
  • Click the "Caption" header's text box in the "Properties" pane.
  • Type in Simple Calculator (or whatever you want to name the calculator).
  • Marvin Fry Marvin Fry

    Update 05 March 2020

    ncG1vNJzZmismaXArq3KnmWcp51ktbDDjK2mZpuimq61sYyaZKyhnaW5pnnCmqOcrZyWwbC%2BjKKlZq6ZqMKiuIybmKyhk2KDcQ%3D%3D