Flag This Hub

Computer Programming: Visual Basic Forms

By


Visual Basic Programming: Forms

 

In my last few articles I discussed computer programming, specifically Visual Basic in Excel. Like I mentioned in my other articles Visual Basic is a very useful programming language. In Visual Basic you can create things called forms. Forms are basically user interfaces in VB.  Forms can include things like text boxes, message boxes, input boxes, list boxes, and buttons. Text boxes are boxes or areas in a form place their by the programmer in which you can input and output information.  They’re pretty flexible in terms what you can do with them. They can be used for outputted calculations and inputting information like numbers. Message boxes are used to show messages. When a message box is activated a box will pop up with a message.

Often these are used to direct and prompt users to do a specific action. For example I may use a message box to tell a user to enter in the number of sandwiches made in a day into an input box.  Input boxes are used to input information into the form. When a input box is activated a box pops up with an empty section (a little text box within the pop up box), the user enters in whatever ever information they are prompted to. List boxes are used to output multiple pieces of data.  For example if  you wanted to output 10 numbers to the form you would have to use a List box since multiple numbers are being outputted to the form. Buttons are probably the most important thing when it comes to using forms in programming.

 When a user wants to execute a specific action in a form they click on a button.  The majority of code in your program if you use a form will be put inside of the button.  In a button functions and other calculations are made. An example would be creating a multiplication function that multiplied 2 numbers by each other. When a user clicks on the button it will multiply the two numbers the user supplied (they user may enter the numbers in a text box or input box, depends on what is on the form).  There is also something called form loading. If you have a program that doesn’t have a button and you want the program to execute as soon as the user enters in information or as soon as the form is opened you would use form loading. 

Form loading is when a program executes without being prompted by a button or action.  Also just like in regular programming it is very important to make sure your form is organized. It is crucial that the user using your program finds the form user-friendly. Using labels in forms is very helpful. You can use labels to label text boxes, list boxes, etc.  In visual basic.net there is a tool bar that appears on the left side of the screen. The tool bar is used to add text boxes, list boxes, labels, buttons, message boxes, input boxes, and other components you might to implement in a form. Remember to keep your form organized. Keeping it organized will make it easier for the user and make it easier for you.

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    Like this Hub?
    Please wait working