AUGUSTEN TECHNICAL

FRESHERS SHINE

Pages

Monday 5 January 2015

IMPLEMENTING THE VISUAL STACK PROGRAM


Step 1: “The blank form properties”First, in the properties window you need to change some of the values. You can change the values by double clicking on the property’s name, on the left side of the window, or single clicking, on the right side, in the property’s value box. This will make a down

arrow visible, but not all the properties have this feature, in such cases; you will need to type in the value. If you would like to know what all these properties are the Visual Basic help system will provide adequate explanation. Most of the properties are named well and are easy to understand.


The first property of the Form that you should change is Text. This is that will be displayed on the top bar of the window. “Form1” will be the default setting; you should replace it with an appropriate name for the form. I used “Visual Stack by Paul Michelbrink”


You can customize your form by changing some of the Appearance properties. By

clicking on the down arrow next to BackColor you can change the background color of

the form. Under the System tab you can select traditional Windows colors. I decided to

go with the Red under the Custom tab.

















ADDING AN ICON:

To add an Icon to your form’s caption, invoke the Icon property box click once to

activate the “Open” window.





You will probably have to browse to

…\Program Files\Visual Studio .Net\Common7\Graphics\Icons

From here you can choose from several folders of icons.











At this point, the form should be red, have the caption at the top that says, “Visual Stack

by [your name]”, and have the icon of your choice in the top left-hand corner.





Step 2: “Adding objects to our form”





First, we must decide what kind of objects we need for our particular application. We

need labels, text boxes, picture boxes, command button, and menus. Fortunately, the tool

box has all the objects we need for our program. The following figure represents the final

look and feel of our application











Now let us turn our attention to how exactly these components should be added to our

form.HOW TO ADD:

COMMAND BUTTONS: The command button are: PUSH, POP, PEEK,INITIALIZE, and EXIT
TEXT BOXES: They are the 3 white boxes in the middle of the form
LABELS: The labels are: All the captions above the various controls
PICTURES: The pictures are: the two arrows and the IU Seals.

You can go ahead and add all the objects to the form. This is easily done by selecting the
appropriate component from the toolbox and clicking on the form. An objects size can be
changed by clicking on any corner and dragging. Alternatively, you may change the
height and width by entering a number in the appropriate property field.

In the previous version of this tutorial the elements of the stack (Strings) were stored as
an array of Labels. Due to changes in the event model Visual Basic .NET does not
support arrays of controls. Instead, Event Handlers allows the programmer to handle
events from multiple controls. This is a valuable improvement since the same event
handler can be used for more than one type of control. For the purpose of this project, it
makes no sense to create 10 labels and try and refer to them by name. It would be much
simpler to create a ListBox, then add and remove strings as the stack is pushed and
popped.

This is what the form should look like after you have added all the objects without setting
the properties.




Step 3: “Changing the Properties of the controls.”

COMMAND BUTTONS:
For each of the command buttons change these properties:

Text: P&USH, P&OP, P&EEK, &INITIALIZE, and E&XIT....
Font: Microsoft Sans Serif, 9.75pt
Name: cmdPush, cmdPop, cmdPeek, cmd Initialize, cmdExit

By putting an ‘&’ in front of a letter in the Text property of a button creates a shortcut the
user can take advantage of by pressing ALT Key and the underlined letter. This will
activate the object as if was clicked on.







0 comments:

Post a Comment