Visual Basic Lab 1

Embed Size (px)

Citation preview

  • 7/29/2019 Visual Basic Lab 1

    1/4

    Visual Basic 2010

    Programming Assignment #1

    (100 Points)

    PROJECT SUMMARY

    Create the user interface shown on the last 2 pages using the naming and appearance guidelines provided.Depending on which button you click when your program is running, the program will either display three

    items/things you like, two items/things you do not like, or cause the program to stop.

    Create a new folder called Chap1 in a location such as C:\Temp or on a Flash Drive or on the S:\drive(files created on the Desktop or in the My Documents folder on your computer will work for you butnot for me, and files created on the H:\drive have occasionally had technical issues during the creationprocess). You will use this new Chap1 folder to store your assignment/solution/project in. Any time yousee XXX in the instructions below, replace the XXX with your 3 initials. As you work through thisassignment, be sure to save your work frequently, using Save All.

    1. Setup the initial VB environment (as described on page #37 of the textbook):Select Always show Error List if build finishes with errorsSelect Track Active Item in Solution ExplorerDeselect Show advanced build configurationSelect Always show solutionSelect Save new projects when createdSelect Warn user when the project location is not trustedDeselect Show Output window when build startsDeselect Prompt for symbolic renaming when renaming files

    2. Open a New Project in Visual Basic 2010.3. If needed, select Windows Forms Application template

    4. Name your project About Me Project (XXX)5. The Location will be the path to wherever your Chap1 folder is (example: F:\CINS 113\Chap1)6. Name your solution About Me Solution (XXX)

    If needed, Select Create directory for solution

    APPEARANCE

    Form

    Title bar of form displays Some Of My Likes And Dislikes (XXX)

    The form should have a light background color of your choice (other than the default light gray).

    The font of the form should be set to Segoe UI, regular, 9pt before any objects are added to the

    form. (If Segoe UI Is not available, use Tahoma, regular, 10pt for the form instead) When the program first starts, the form is to appear centered on the screen.

    The size of the form should be 600 x 450.

    The form should be named MainForm_XXX

    The form file should be named Opinions of XXX.vb

    Labels

    The topmost label has a text property ofHeading Area. It is Microsoft Sans Serif, Bold Italic (orBold Oblique), 16pt and centered in the form horizontally. Have the AutoSize property set to

  • 7/29/2019 Visual Basic Lab 1

    2/4

    True. Name it headingLabel. The text property of this label will change when you click on abutton when the program is running.

    The next 3 labels will have respective text properties ofItem1 Area, Item2 Area, & Item3Area. All 3 are set to Microsoft Sans Serif, Regular, 12pt, and have AutoSize set to True. Namethem item1Label, item2Label, and item3Label. They should be left-aligned with

    headingLabel. The text property of these labels will change when you click on a button whenthe program is running.

    Buttons

    The 3 buttons should display the text shown on the print screens of the GUI below. The 3 buttonsare Tahoma, Bold, 10pt and are named iLikeButton, iDislikeButton, and exitButton.

    AutoSize the iDislikeButton, then make the other two buttons the same size horizontally andvertically.

    The tops of all 3 buttons should be the same (Y-values identical).

    The horizontal spacing between all 3 buttons should be the same.

    The 3 button set should also be centered in the form horizontally.

    Depending on which operating system you are using (Windows XP or Vista or Windows 7), yourbuttons will have a different default look. For example, in Windows XP, they will have taken on

    the same BackColor as the form, while in Vista, they will appear as a two-tone gray (even though

    the BackColor property indicates it is colored). To give the buttons a consistent look across alloperating systems, change the BackColor to White for all buttons.

    Other

    The final/bottom-most label (displaying your name) is left-aligned with the iLikeButton. Bydefault, its font will be that of the form. Set Autosize to False and manually make it large enough

    to display the text This program created by Ffffff Lllllll (the Ffffff Lllllll are to be replacedwith your first and last name). Name this object/control authorLabel.

    The exact vertical positioning of the 5 labels and 3 buttons on the form is up to you, but thevertical spacing between headingLabel, item1Label, item2Label, & item3Label should bethe same.

    Once your GUI looks correct, Lock Controls on the form so your objects/controls can not beaccidentally moved.

    CODING

    Code the Exit button so the program will exit/close when the user clicks on the button. Run yourprogram to make sure it works.

    Code the 3 Things I Like button so it displays 3ThingsILike3ThingsILike3ThingsILike3ThingsILikein headingLabel. Within thesame event procedure, code the program (by assigning text strings) to display 1 item that you like

    in each of the respective text properties of item1Label, item2Label, & item3Label.

    Code the 2 Things I Dislike button so it displays 2Things2Things2Things2ThingsIDislikeIDislikeIDislikeIDislikein headingLabel. Withinthe same event procedure, code the program (by assigning text strings) to display 1 item that youdislike in each of the respective text properties of item1Label & item2Label. Change the visible

    property of item3Label so that the object/control can not be seen on the form (since only 2, not 3,

    items are to be displayed by this button). Dont use an empty string () to make item3Labeldisappear.

  • 7/29/2019 Visual Basic Lab 1

    3/4

    WHY YOU NEED TO TEST YOUR PROGRAM

    Think youre done? Start your program. Click the 3ThingsILike3ThingsILike3ThingsILike3ThingsILikebutton. Output OK? Click the2ThingsIDislike2ThingsIDislike2ThingsIDislike2ThingsIDislikebutton. Output OK? Pretty confident your program is worth 20 points out of20? Not so fast! Click the 3ThingsILike3ThingsILike3ThingsILike3ThingsILikebutton again. Your three items should be displayedagain, not just the first two. It is up to you to figure out how to solve the problem if you want a

    perfect score. Hint: you will want to use/manipulate the visible property somehow.

    Print a copy of your code and the form, then do a final Save All. Keep these printouts until this lab isreturned to you graded. If for some reason your zip file does not open correctly for the instructor, these

    printouts can be used as an alternative grading source.

    PROGRAM SUBMISSION1st: Using 7-Zip, WinZip, or some other compression program, take the Chap1 folder [it should have

    one child folder the solution folder called About Me Solution (XXX)] and both compress andencrypt Chap1 into a .7z or .zip file. Set the password as CINS. The resulting compressed file willbe found in the parent folder ofChap1.

    2nd: Using the E-mail feature found in E-Learning (Campus Connect), send the resulting .7z or .zip file

    to your instructor as an attachment. Make sure the subject line of the e-mail contains 3 items. (1) theprogram number, (2) the operating system you used when you created your program [ Windows XPor Vista or Windows 7], and (3) your full name (e.g. Program #1 Vista Firstname Lastname).

    3rd

    : Move your Chap1 folder if it is in the C:\Temp or the S: drive to your home locker (H drive) formore secure storage.

    Reminder: For full credit, the e-mail must be received by the beginning of the class on the due date.

    This print screen shows what the GUI should look like in the Windows Form Designer Window and whatyou will see before any buttons are clicked on when the program first runs/loads.

  • 7/29/2019 Visual Basic Lab 1

    4/4

    What the GUI would look like after you click the leftmost button (your 3 items will vary).

    What the GUI would look like after you click the center button (your 2 items will vary).