Presentation is loading. Please wait.

Presentation is loading. Please wait.

Labs for week 2.

Similar presentations


Presentation on theme: "Labs for week 2."— Presentation transcript:

1 Labs for week 2

2 First…Week2 lab1 Practice using the \ (integer mod) operator in a form. Provide a textbox for input and a textbox or label for output, and a button to start computation. In the button_clicked subroutine declare variables: Dim inputint, onesdigit as Integer Now, get input from textbox and convert into an integer. (Recall: use Integer.parse(..) Code for this step not shown but is in previous lab and powerpoints.) Next get the one’s place off the input value. Code to get the one’s place: Onesdigit=inputint mod 10 ‘ gives remainder on division by 10 (display onesdigit in textbox or label… code not shown)

3 Continue… Lab2 The digit extractor project needs to keep getting more digits, but if you execute Onesdigit=inputint mod 10 again, you get the same thing. Change inputint as follows: inputint=inputint \10 ‘integer division Now try Dim tensdigit as integer tensdigit=inputint mod 10 And then display tensdigit in a another label or textbox.

4 Lab3. Checking for data entry error
The payroll project requires input error checking. Build a form with a textbox for input, a label for output, and a button to initiate action. Use code from our first week lab in button click: Dim value as double Value=double.parse(txtinput.text) Lbloutput.text=value.tostring(“n3”)

5 Now add error-checking
Add the code to check for a numeric input error. Notes for this appear in the 2nd powerpoint for the course in the book-order form application as well as in the next slide.

6 Adding input error checking
Try ‘ put the get, parse and display code here Catch theexception As FormatException ‘put errorhandling code here…like… MessageBox.Show("Data entry error“) End Try


Download ppt "Labs for week 2."

Similar presentations


Ads by Google