Lab 0

Getting Acquainted with the Visual Basic Environment

Testing Video for Lab0

Sample executables for all assignments will be made available in a folder called Sample Executables found on the Lessons/CIS122 - Content tab in Angel. You can use these sample files to ascertain how your programs should function. To run a sample you must first save the .exe file to an appropriate storage location, once saved you can double-click on the file to execute it.

Your task:

Create a program that will
      1) Display in a Label input a user types in a textbox
      2) Erase the text displayed in the TextBox and the Label
   

 Lab 0 image

Steps to follow

Create the interface:

  • Create an interface with one TextBox, one label, and two command buttons similar to the preceding image. The Label, located just below the TextBox is not noticeable in the image because there is nothing displayed in it.
  • Name the project your initials followed by _Lab0 (mine would be khc_Lab0)
  • Name each control appropriately. Prefix for Textbox - txt, Labels - lbl, command buttons - btn, and forms - frm. You might call the Label - lblData, the Text Box - txtData, the Command Buttons - btnCopy and btnClear, and the form - frmLab0.
  • Change the Font style and size for all four controls by changing the Font property for the Form.
  • Using the Properties Window delete the Text property for the Label and the TextBox. Your label seem to "disappear" once you have deleted the contents of the Text property.
  • Add appropriate Texts for the command buttons.
  • Include your name in the title bar of the Form.
  • Change BackColor and ForeColor properties as desired.

Put code behind the command buttons:

  • To put code behind the buttons double click on the button. An event procedure shell will be created automatically for you. Place all commands you wish to execute when the user clicks on the button between the Private Sub-.. and the End Sub statements.
  • The Copy command button will copy the Text property of the TextBox to the Text property of the Label.

           
    lblData.Text= txtData.Text
           
  • NOTE: you must use the names you assigned to the Name property of the respective control.
  • The Clear command button will set the Text properties to empty.

            lblData.Text= ""
            txtData.Text = ""

Document

Add comment lines at the top of your code window with your name and a brief description of the program. Use the apostrophe to indicate comment.
                  
              'Your Name
              'This is my first program it .......

                   

Save your program:

Save to your storage device. If you do not have personal storage device you may save your project to the Desktop. Projects saved to the Desktop may be compressed and then sent via email or uploaded to your Files area found in the Toolbox on your Home page in Angel.
Files saved on the Desktop must be removed before you leave. They will not be available on subsequent days.

 Test your program.

To run your program you could

1 - Click the "play" button on the tool bar
2 - Choose "start debugging" from the Debug menu
3 - Press the F5 key

To end the program

1 - click on the close window button in the top right hand corner of the form.
2 - Click the "stop" button on the toolbar
3 - Choose "stop debugging" from the Debug menu

Exit Visual Basic

and then reopen your project to be sure you can locate and reopen your work

Create a compressed folder of your project

Locate your project folder and right-click on it. Choose Send To / Compressed (zipped) folder

Submit your project

Attach the zipped folder to your submission in the appropriate DropBox