AUGUSTEN TECHNICAL

FRESHERS SHINE

Pages

Monday, 5 January 2015

LABELS,TEXT BOX,LIST BOX,MENUS IN VISUAL STACK & VISUAL BASIC .NET



LABELS:

As I mentioned before Visual Basic .NET does not support control arrays, so all of the labels on the form will be simple labels. You can go ahead and change the same properties you changed for each command button using the format “lblXxxxxx” for the name. e.g. lblEdit





TEXT BOX:

This object that will allow the user to enter a string, we will also use text boxes to display the last popped string, and the string on top of the stack. The string entered will later be pushed onto the stack. You should set all of their Text properties to an empty string, and name them:

txtEnterString

txtPoppedString

txtTopString





LIST BOX:

The list box on this form will be the object that stores the data of the stack. When the user

enters a string in the text box and clicks the Push button, the string will be placed on the

top of the stack. I will show you the code for this later, but for now just rename the object

lstStack. I also changed the BackColor of the List Box to match rest of the form.





MENUS:

Previous versions of Visual Basic contained a utility called Menu Editor, but .NET uses

Menu Objects. If you ever had you use the Menu Editor you will probably find the .NET

approach a big improvement.





The first thing you should do is select Main Menu from the ToolBox, and then click on

the form. This will create a small box on the top of the form that reads “Type Here”.

Whatever you type in that box will become the caption of the menu. I entered “Stack

Information”, and immediately a “Type Here” box appeared next to and below “Stack

Information”. To create a sub-menu, simply type a caption in the lower box. I used

“Definition”, and below that I used “About this Program”.





Selecting one of these menu items will open a new form that displays some text. Later

we will enter the code for opening these new forms, but for now just rename the menus

“mnuDefinition” and “mnuAbout”










When you click on something other than a menu item, the menus will disappear. Clicking on the on the MainMenu1 icon in the component tray at the bottom of the page will bring it back.





To make the menu stick to the form, bring up the Stack form Properties window and

change Menu under the Window Style section. It should read (none), by clicking on the

down arrow you can change it to MainMenu1.

















We are now finished with all of the object’s properties; you can change any of them to fit

your style. These are just the basics to get the program started. Colors, font, font sizes,

pictures, and positions are all optional according to your taste.Click on the Debug menu, and then select Start. Your form will be compiled and an
instance of it will start running. It should look something like this:






Clicking on any of the buttons will have no consequence, but be patient, we will add the


code soon.

0 comments:

Post a Comment