Visual Basic
Lesson 5- Building a Program, Pt 1
Now, we are going to build a functional program together! We'll use everything you know so far. Here in part 1, we will create the form. In part 2, we will code.
Step 1:
Start a new project, just like how I showed you. Name it movie_calculator .
Step 2:
We're gonna build a movie calculator. Imagine you're at the movies and you order a ticket, candy, popcorn, and drink. This program will add it all up to give you a "receipt!" This is what I want you to add:
- 2 labels for tickets: Adult ($7.00), and Child ($5.00). Add text boxes with them too. Make sure you set the text to 0 for all of your text boxes. You'll notice that in my example.
- GroupBox for popcorn. (Hint: You can find the GroupBox under the Containers subheading in the ToolBox) Add RadioButtons for sizes small ($3.50), medium($5.00), and jumbo($8.50).
- GroupBox for drinks. Add labels for large ($6.00) and medium ($4.50). Add text boxes next to them for quantity.
- GroupBox for candy. In check boxes, add 3 candies of your choice with prices.
- A receipt in a GroupBox. In that receipt, I want a Ticket Total, Popcorn Total, Candy Total, Drink Total, and an overall Total. These will be in labels. Add labels next to those and set the text to 0.
- Button for calculations.
- Make it neat!! Add your own fonts and a nice background color!
When you are finished it should look like mine:
This image is here for you to reference, not copy! Make it your own!
Step 3:
Now, let's assign Names. Here is where you'll need to add names:
- In the 2 text boxes for the tickets (Hint: I'll help with the first one. Call it txtadtick.)
- In the 2 text boxes for the drinks.
- All of the check boxes. (Hint: I'll help with this too. Notice how my first candy is skittles? Well, I named it chkskit.)
- All of the labels next to the totals. Meaning, all of the 0's need a name. (Hint: I named my ticket total lbltick, the popcorn total lblpop, and so on.)