Visual Basic Assignment #1
This page has been visited
times since March 1, 1999.
What topics are covered in this assignment?
What properties are we going to use?
| Control | Properties we will use |
| Form | Caption |
| Label | Name, Alignment, BorderStyle, Caption, Font, ForeColor |
| CommandButton | Name, Caption, Default |
| TextBox | Name, Text |
Notes:
The form is the center of a Visual Basic program. All the controls that we want to use are placed on one or more forms. When we create a new program, a blank form called Form1 is placed on the screen. Controls are then added to this form to create a working Visual Basic program. Labels, text boxes, and command buttons are called controls because they help control the way a Visual Basic program works. Most controls have properties that can be changed at design time or at runtime. Properties affect the control in some way: either the shape, size, color, contents, or what it does. Design time is the period of time when you are writing the program. Runtime is the period of time when the user is running the program.
Thus by changing a control's properties we can affect the way it looks on the screen. Some of the properties we will be changing in this assignment are font, forecolor, alignment, and caption. For example, by changing a label's caption and font properties we can change what is printed on the label and what type of font it is printed in. Labels can be used either to print headings or to show results. To print headings in a label, change the caption property at design time. To show results in a label use the label.caption command in your program. For example, label1.caption = "Hello" prints the word Hello in the label. The command label1.caption = textbox1 prints the contents of a text box in a label. You can also add strings together and place the resulting string in a label. For example: label1.caption = "Hello " + textbox1 + ", how are you?" adds two strings and a textbox together and puts the final string in a label.
Text boxes are used to read data from the user. Text boxes have many properties that can be changed. We will be changing our textbox fonts so that they are easier to read. Command buttons are used to do something when the user clicks the button. This is done by attaching Visual Basic code to the click event of the button. Then when the user clicks the mouse on the button, Visual Basic automatically runs the program code that we specified. You enter the code by double clicking the button in design mode. This opens the procedure block where you can enter Visual Basic code to handle the click event. You can move back and forth from your form to your code by using the view code and view object menu choices.
Description of Assignment #1
In this assignment you will write a program that uses labels, command buttons, and text boxes. Rather than try to explain what I want you to do, I have decided to give you a copy of the .exe file that does it. Just download the file below, unzip it in a folder on your computer, and double-click on it from My Computer or Explorer. This will run the program so you can see what it does. Your task is to write a Visual Basic program that does exactly what mine does. Of course you can use a different user interface, but the function of the programs must be identical.
Please include some comments in your program. As a minimum for comments I would like to see your name, assignment number, and program purpose at the top of the main file. Also each procedure should have a short comment indicating its purpose. You can place comments anywhere in your program by first typing the ' character. Everything on that line that follows this character is considered to be a comment and is ignored by the compiler.
When you are done the program, email all the required files to me as attachments. Each Visual Basic program requires several files in order to run, so you must make sure that you send me all the files needed. To make this task simpler, you should use a separate folder for every Visual Basic program you write. That way, there will be no doubt about what files go with what program. If you do not know how to create new folders, please ask someone to teach you. It is very easy to do and it will keep your assignments organized and easy to locate.
If you do not know how to use WinZip or Pkzip you will have to learn, as this is the method I will use to send you information. It is also the method used by most people to transfer information on the Internet. WinZip works under Windows 95 and Pkzip works from DOS. I recommend that you get WinZip if possible. It has a graphical interface and is much easier to user. However either one will get the job done. I have supplied a link to the WinZip home page where you can get the latest copy of WinZip. I also have a link so that you can download the assignment file as mentioned above. It is in the .zip format, so the first thing you will have to do is unzip it to a folder on your computer. You can then run it by double-clicking on it in My Computer or Explorer.
If you have any problems with the above instructions, please e-mail me.
Below are the assignment 1 downloads:
If you have Visual Basic
6 installed on your computer, download the Assignment #1 file only.
If you do not have Visual Basic 6 installed on your
computer, download the
Assignment #1 file and required .dll files. To run, place all files in the same
directory and double-click on talk2me.exe.
Assignment #1 file only (4,000 bytes)
Assignment #1 file and required .dll files (1.3 million bytes)
Exercise #1 (4,000 bytes)
To e-mail me click here
Page created and maintained by Ron Patterson