Visual Basic, and from the File menu, choose "New Project". Select "Windows
Forms Project" as the type, and name the project "Option Calculator".
After this step, you should have a small blank form on your screen,
Click on the dark blue header bar of
Form1. You should see a Property Window on the right side of your screen
display all the different Properties you can set for Form1. Scroll down
the Properties and find the Property for "Text". Change the
Property from "Form1" to "Option Calculator". This
will change the text in the title bar of the form to Option Calculator.
The Name Property of the form should still be Form1.
(If you cannot
see a window called "Properties" on the right side of your screen, open
the "View" menu, select "Other Windows", and then select "Properties
At this point, click the "Save All"
icon in the menu bar, or choose "Save All" from the File Menu.
Visual Basic will offer to save the project with the name "Option
Calculator". Accept the name, and check the box for "create
directory for solution" if it is not already checked, and click
"OK". Now your project has a space on disk, and every time
you complete one of the steps in the project, clicking the "Save"
icon will save your work.
can enlarge the form by grabbing any edge or corner with your mouse,
and dragging. The Form is where you will put all the controls that make
up the visual part of your project - the things like entry boxes and
buttons that you can see and interact with when you run the program.
Go ahead and make the form wider by grabbing the right edge and dragging
to the right with your mouse a couple inches.
the code we will be giving in later steps is put "behind the scenes"
of the Form or other modules, and is therefore usually called "code
behind". We will show how to do that later with the first function,
the NORMSDIST function.
now, what we are calling the Entry Fields are fields or controls that
allow you to enter all the information that is required in order to
calculate the price of an option. These fields include the type of option,
the entry date, the stock price, the strike price, the expiration date,
the interest rate, the implied volatility, and the total amount of dividends
to be paid in one year.
we will add what is called a "Panel" to the form. Then we will put most
of our other controls on the panel. The purpose of a Panel is to keep
various controls grouped together. Then they can be moved as one unit,
or copied and pasted as an entire unit. You will need to do both of
these things as the project progresses.
add a Panel, hover your mouse over the "Toolbox" tab on the left side
of your screen, then find the "Containers" category, and click on "Panel".
Now click on Form1, and you should have a Panel on Form1.
(If you cannot
see a tab labeled "Toolbox" on the left side of your screen, open the
"View" menu, select "Other Windows", and then select "Toolbox".)
panel you added will not be large enough to hold all the controls we
need. To make it the right size, select the Panel and look in the "Properties"
window on the right side of your screen. Click on the "+" next to the
entry for "Size" and change the width to 718 and the height to 42.
make the Panel stand out, find the Property for "BackColor" and choose
a color you like. The example uses "LightBlue".
using the picture below as a guide, work left to right and add each
of the controls shown below by clicking the type of Control in the Toolbox,
then clicking on the Panel in Form Design. Set the properties by using
the Properties window while each Control is selected. Be sure you place
each Control on the Panel so that it becomes part of the Panel.
Names are important - that is how the "code behind" will know which
control has the value needed to perform a particular calculation. The
names used in code must match the names of the controls.
your Project at this point, by clicking on one of the save icons or
using the File Menu "Save" item. Give your project the name Option Calculator
if you did not already.
1: Copy the details for ONE control from this page, then Paste the details
for that one control into the Visual Basic "Immediate Window". That
way, you can have all the information you need on one screen.
you finish with one control, right-click on the Immediate Window and
"Clear All", then come back and get the next control. You can't put
all control details in the Immediate Window at once, because the Immediate
Window does not keep text formatted - it will all get strung together
on one very long line.
(If you cannot
see a window called "Immediate Window" on the bottom of the Visual Basic
layout screen, press "CTRL-G" to open it.)
TIP 2: When setting the "Location"
Property, you do not need to type the numbers. Simply click on the Control
on the Form and look at the "Location" entry in the Properties
Window. Then use your computer's arrow keys to move the control left,
right, up, or down until it is in the Location specified.