FIT 100. Lab 10: Creating the What s Your Sign, Dude? Application Spring 2002

Similar documents
These tasks can now be performed by a special program called FTP clients.

CREATING A DONOR ACCOUNT

Enabling Your Personal Web Page on the SacLink

Gmail and Google Drive for Rutherford County Master Gardeners

Qualtrics Instructions

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

from DDS on Mac Workstations

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Campuses that access the SFS nvision Windows-based client need to allow outbound traffic to:

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

1on1 Sales Manager Tool. User Guide

Lab 0: Compiling, Running, and Debugging

Because of security on the site, you cannot create a bookmark through the usual means. In order to create a bookmark that will work consistently:

Exporting and Importing the Blackboard Vista Grade Book

Scroll down to New and another menu will appear. Select Folder and a new

Word 2007 The Ribbon, the Mini toolbar, and the Quick Access Toolbar

Managing Your Access To The Open Banking Directory How To Guide

Proper Document Usage and Document Distribution. TIP! How to Use the Guide. Managing the News Page

Renewal Reminder. User Guide. Copyright 2009 Data Springs Inc. All rights reserved.

TRAINING GUIDE. Lucity Mobile

Using the Swiftpage Connect List Manager

Quick Start Guide. Basic Concepts. DemoPad Designer - Quick Start Guide

Using the Swiftpage Connect List Manager

UiPath Automation. Walkthrough. Walkthrough Calculate Client Security Hash

Access the site directly by navigating to in your web browser.

ROCK-POND REPORTING 2.1

How to Start a New Prezi & Edit It

TRAINING GUIDE. Overview of Lucity Spatial

COP2800 Homework #3 Assignment Spring 2013

HOW TO live-stream softball on a minimal budget

Lab 1 - Calculator. K&R All of Chapter 1, 7.4, and Appendix B1.2

My Dashboard Instructions

You may receive a total of two GSA graduate student grants in your entire academic career, regardless of what program you are currently enrolled in.

Adverse Action Letters

Quick Tips

Element Creator for Enterprise Architect

INSTALLING CCRQINVOICE

STIDistrict AL Rollover Procedures

Center School District. SMART Board Quick Reference

FollowMe. FollowMe. Q-Server Quick Integration Guide. Revision: 5.4 Date: 11 th June Page 1 of 26

Test Pilot User Guide

RISKMAN REFERENCE GUIDE TO USER MANAGEMENT (Non-Network Logins)

Information on using ChurchApp

Wave IP 4.5. CRMLink Desktop User Guide

STUDIO DESIGNER. Design Projects Basic Participant

Lab 4. Name: Checked: Objectives:

USO RESTRITO. SNMP Agent. Functional Description and Specifications Version: 1.1 March 20, 2015

Class Roster. Curriculum Class Roster Step-By-Step Procedure

Adobe Connect 8 Event Organizer Guide

SmartPass User Guide Page 1 of 50

Tips and Tricks in Word 2000 Part II. Presented by Carla Torgerson

User Guide. Table Of Contents. Logging In. Job Search. Job Information. Site Search & Logging A Job. Customer Search. Job Dashboard.

Assignment 10: Transaction Simulation & Crash Recovery

CS1150 Principles of Computer Science Introduction (Part II)

LAB 7 (June 29/July 4) Structures, Stream I/O, Self-referential structures (Linked list) in C

MySqlWorkbench Tutorial: Creating Related Database Tables

Enterprise Installation

Ascii Art Capstone project in C

Installing the Citrix Citrix Receiver 3.3 from Citrix Web Interface for SSL VPN Users

Interfacing to MATLAB. You can download the interface developed in this tutorial. It exists as a collection of 3 MATLAB files.

6 Ways to Streamline Your Tasks in Outlook

Text Services Customer Guide

Municode Website Instructions

Outlook Web Application (OWA) Basic Training

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Quick start guide: Working in Transit NXT with a PPF

REFWORKS: STEP-BY-STEP HURST LIBRARY NORTHWEST UNIVERSITY

Panorama Offsite Access Prepared for: WRHA Mass Immunization Events

WebEx Web Conferencing Quick Start Guide

Employee Self Service (ESS) FAQs

Trimble Survey GNSS Firmware Version 4.81 (July 2013)

Tips For Customising Configuration Wizards

ADVANCE IT. Best Practices. Taking MaintenanceDirect to the Next Level 10/27/2014. Angela Cullen, Client Advisor SchoolDude 10/27/2014 SCHOOLDUDE

How to use DCI Contract Alerts

MOS Access 2013 Quick Reference

HFA Application/Presurvey Questionnaire Instructions

Integrating QuickBooks with TimePro

Client Configurations

Reading and writing data in files

Network Rail ARMS - Asbestos Risk Management System. Training Guide for use of the Import Asset Template

Manual for installation and usage of the module Secure-Connect

TUTORIAL --- Learning About Your efolio Space

Student Guide. Where can I print? Charges for Printing & Copying. Top up your Print Credits Online, whenever you like

Entering an NSERC CCV: Step by Step

Working With Audacity

istartsmart 3.5 Upgrade - Installation Instructions

TECHNICAL REQUIREMENTS

Automatic imposition version 5

August 22, 2006 IPRO Tech Client Services Tip of the Day. Concordance and IPRO Camera Button / Backwards DB Link Setup

APPLICATION FORM. CISAS opening hours: 9:00am to 5:00pm, Monday to Friday

Your New Service Request Process: Technical Support Reference Guide for Cisco Customer Journey Platform

Constituent Page Upgrade Utility for Blackbaud CRM

TaiRox Mail Merge. Running Mail Merge

New Tenancy Contact - User manual

Network Rail ARMS - Asbestos Risk Management System. Training Guide for use of the Import Survey Template

CROWNPEAK DESKTOP CONNECTION (CDC) INSTALLATION GUIDE VERSION 2.0

Unity Voic Migration and User Guide

Cortex Quick Reference Supplier Guide Service Receipt Rejections for Husky Suppliers

USER MANUAL. RoomWizard Administrative Console

The screenshots/advice are based on upgrading Controller 10.1 RTM to 10.1 IF6 on Win2003

Transcription:

FIT 100 Lab 10: Creating the What s Yur Sign, Dude? Applicatin Spring 2002 1. Creating the Interface fr SignFinder:... 1 2. Creating Variables t hld values... 4 3. Assigning Values t Variables... 4 4. Click Event Prcedures... 4 5. Simple Errr Trapping... 5 6. Creating an Executable File:... 7 7. Lab Ntebk Questins... 7 Reading fr Lab 10: p. 97-105 in Chapter 5 f Cmputer Prgramming Fundamentals with Applicatins in Visual Basic 6.0 p. 151-154 in Chapter 7 f Cmputer Prgramming Fundamentals with Applicatins in Visual Basic 6.0 Intrductin Tday yu create a prgram and call it SignFinder. In this prgram, a user will click n the radi buttn fr the mnth f their birth but they will enter the exact date f their birth as well. When the OK buttn is clicked, the prgram will have t decide which sign t display depending n where their birth date falls in the mnth. Objectives T understand the imprtance f bject names when changing prperties and assigning values with cde. T be precise in the declaratin f variables and understanding hw t assign values t them. T take input frm an unknwn user and assign that value t a variable and use it as part f the lgic f the prgram. T steadily add pieces f cde t yur prgram and increase it s cmplexity. 1. Creating the Interface fr SignFinder: If yu have created a flder hlding the frm and all required cntrls fr Lab 10 already, dwnlad it frm Dante t the desktp. Then g t that prject and pen it up and mve t step 2. If yu have nt created the frm yet, pen a new Standard EXE and in the frm, enter the fllwing cntrls: A. Create a flder n the C drive called Lab10_yurname. Save the prject and frm in this lcatin later. B. Open up Visual Basic. Yur frm (the interface) fr this lab will require the fllwing bjects: 2 labels 2 cmmand buttns

1 text bx 12 ptin buttns (radi buttns) The interface may lk similar t the ne belw, but use whatever clrs and setup that wrks fr yu: **A gd way t keep track f the names wuld be t print ut the figure abve and put the name yu will give each cntrl next t its image** C. Make the captins f the labels and ptin buttns similar t the interface abve. The names f each bject shuld be meaningful t yu s that as yu cde, yu will be able t identify them prperly in the statements. D nt include any spaces in an bject name.

What s in a Name? A gd name fr the label giving the user the infrmatin t enter their birth infrmatin might be: lblenter A gd naming scheme fr the ptin (radi) buttns wuld be t start each with pt and fllw it with the mnth they identify. An example fr the January buttn wuld be: ptjan Name the cntrls (bjects) that are left with names that are usable fr yu. A suggested naming cnventin wuld be the fllwing: Object Type Frm Cmmand Buttn Text Bx Label Optin Buttn Picture Bx CheckBx Timer Name starts with frm cmd txt lbl pt pic chk tmr D. Change the fnt clrs and backgrund clrs t smething pleasing. E. Change the name f yur prject t SignFinder in the Prject > Prject 1 Prperties menu and name the frm bject as frmsignfinder. F. Save the prject and the frm t the Lab10_yurname flder. Lgic f the prgram Once yu have the frm (interface) taken care f, it s time t deal with the lgic the cde. The detailed lgic f the prgram is as fllws: A user runs yur prgram at their cmputer. The frm pps up and they are requested t select the ptin buttn that states the mnth f their birthday and t enter an integer value that is their birth date. Once they have dne this, they click n the OK cmmand buttn and a label will appear n the frm that states their Zdiac sign. The prblem the prgrammer encunters is that the signs f the Zdiac d nt have a ne t ne crrespndence with each mnth. Depending n the day invlved in any mnth, a persn may be ne f tw signs. This calls fr use f a cnditinal t help the prgram decide. But first, there are a number f things t cnsider: Where d yu stre the Zdiac values? Every mnth will ptentially have 2 t chse frm. Where d yu stre the input frm the user? Where d yu stre the date fr each mnth that will determine whether a user is ne sign r anther?

2. Creating Variables t hld values A. Declare 4 separate variables at the tp f yur prgram after yu enter the Optin Explicit statement: The first variable will hld the Zdiac sign value fr the lwer half f each mnth and be a string data type: lsign The secnd variable will hld the Zdiac sign value fr the upper half f each mnth and be a string data type: hisign The third variable will hld the value f the day each mnth when the signs change and be an integer data type: changeday The furth variable will hld the value entered by the user that is their birth date and be an integer data type: birthday 3. Assigning Values t Variables A. In each ptin buttn click event, assign the crrect sign values t the lsign, hisign and changeday variables: Mnth lsign hisign changeday January Capricrn Aquarius 19 February Aquarius Pisces 18 March Pisces Aries 20 April Aries Taurus 19 May Taurus Gemini 20 June Gemini Cancer 20 July Cancer Le 22 August Le Virg 22 September Virg Libra 22 Octber Libra Scrpi 22 Nvember Scrpi Sagittarius 21 December Sagittarius Capricrn 21 B. Where d yu g frm here? If a user clicks n any f the radi buttns, the values will be assigned t the variables crrectly. Nw it s time t wrk with the OK buttn click event. Mst f the prgram lgic ccurs here. 4. Click Event Prcedures A. In the cmdok_click() event d the fllwing:

Assign the value the user enters int the text bx t the variable birthday. T get t the value entered in the text bx, access the Text prperty. Make the label which will display the persn s sign and the G Again cmmand buttn appear and the text bx and OK buttn disappear. Set the visibility prperties t true r false where needed. Write a general cnditinal that will check t see if the value the user has entered is greater than the changeday. If it is, then the label that yu are using t display the Zdiac sign shuld display Yur sign is & hisign &! in the captin. If it isn t greater than changeday, then the captin will read: Yur sign is & lsign &! **NOTE** The & symbl is used t cncatenate string values tgether [place them tgether, side by side]. If a value in a variable is an integer, it is cnverted t a string value fr purpses f cncatenatin. B. In the G Again buttn click event, write the apprpriate statements t make the labels and text bxes and buttns appear again t start the prgram ver. (Think abut resetting the ptin buttns and clearing ut the text bx.) C. Save yur prject. D. Run yur prject. Is everything wrking? What happens if the user enters a letter instead f an integer? 5. Simple Errr Trapping Often the user will nt enter the infrmatin we (as prgrammers) wish them t enter. If they d, fr example, enter letters when we expect numbers and we haven t planned fr it, it will stp ur prgram. One frm f Errr Trapping is t let the user knw they have entered incrrect infrmatin and ask them t enter it again. A. The syntax used t start an Errr Trap statement is the fllwing: Private Sub.. (this culd be any event prcedure) On Errr GT <name f errr handler> <ther cde statements in the prcedure> Exit Sub <name f errr handler>

<statements t be executed when errr ccurs> End Sub B. The best place t trap any errrs in this prgram is in the OK buttn click event, since all the ther lgic is taking place there as well. Call the errr handler CheckInput, since it is checking input. Yu will use a Message bx in the errr handler statements as a way t alert the user t change their input. The cde fr the errr handler is in clr and bld belw. Remember, if yu haven t used the same variable names and bject names IT S OK! Yur cde will lk different frm the statements belw that aren t in bld: Private Sub cmdok_click() On Errr GT CheckInput birthday = txtuserinput.text If birthday > changeday Then lblzdiac.visible = True lblzdiac.captin = "Yur sign is " & hisign & "!" Else lblzdiac.visible = True lblzdiac.captin = "Yur sign is " & lsign & "!" End If cmdok.visible = False cmdgagain.visible = True txtuserinput.visible = False Exit Sub CheckInput: MsgBx "Please enter a valid date and check a mnth", VBOKOnly End Sub txtuserinput.setfcus C. Run yur prgram. What happens if yu enter a letter nw? D. What happens if yu enter a number that is negative r abve the days in the mnth? The errr trap desn t yet have a way t accunt fr that, s add anther cnditinal t take care f thse ptential errrs. The statement t add (if yu have used the crrect variable names) is in bld belw. Ntice the Errr Trap name is in red: birthday = txtuserinput.text A Message Bx is used in VB 6 t cmmunicate with the user. It can alert them t enter valid data, cnfirm an actin r simply keep the user infrmed. Here the bx will use an OK buttn as a way t let the user cnfirm the message.

If birthday < 1 Or birthday > 31 Then GT CheckInput If birthday > changeday Then lblzdiac.visible = True lblzdiac.captin = "Yur sign is " & hisign & "!" Else lblzdiac.visible = True lblzdiac.captin = "Yur sign is " & lsign & "!" End If The bld cde statement abve nw checks t see that the number a user enters is inside f a certain range (between 1 and 31). If it isn t, the message bx cmes up again and tells them t check their input. This errr trap isn t perfect (what abut mnths with less than 31 days?), but I ll let yu add t the cde t perfect it if yu like! E. Run yur prgram again. Try t enter infrmatin that will break it. Can yu d it? 6. Creating an Executable File: A. Make SignFinder executable when yu are finished and happy with it. Save yur prject and FTP the entire Lab10_yurname flder cntaining yur prject, frm and executable t yur Dante accunt. Yur TA will let yu knw if they wish t see this prgram by the end f this lab r the beginning f the next. B. Remember t lg ff the machine as yu leave. 7. Lab Ntebk Questins A. Write a cnditinal that will test the fllwing: A persn can buy sdas r juices at a sda stand. A sda, if that is what the want, csts 75 cents. Since yu nly sell sda r juice, if they dn t want a sda then they must want a juice. Juice csts $1, unless it s cranberry juice. Cranberry juice is $1.25.