Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3 Part 21 Displaying Output Chapter 3 Section 3.5Output Formatting Chapter 3 Section 3.6Group Boxes, etc. Chapter 3 Section 3.7Sample Program Chapter.

Similar presentations


Presentation on theme: "Chapter 3 Part 21 Displaying Output Chapter 3 Section 3.5Output Formatting Chapter 3 Section 3.6Group Boxes, etc. Chapter 3 Section 3.7Sample Program Chapter."— Presentation transcript:

1 Chapter 3 Part 21 Displaying Output Chapter 3 Section 3.5Output Formatting Chapter 3 Section 3.6Group Boxes, etc. Chapter 3 Section 3.7Sample Program Chapter 3 Section 3.8Logic Errors

2 Chapter 3 Part 22 Number Formats FunctionDescription FormatNumberIncludes commas and specified number of decimal points. FormatCurrencyIncludes commas, decimal points, and currency symbol. FormatPercentFormats value as a percent. FormatDateTimeFormats expression as a date, time, or both.

3 Chapter 3 Part 23 FormatNumber Function Default Format 2 decimal places Commas as needed Syntax FormatNumber(value) Examples FormatNumber(12345.678)12,345.68* FormatNumber(12)12.00 FormatNumber(.75)0.75 Note: Rounding occurs.

4 Chapter 3 Part 24 FormatNumber Function* Optional Argument FormatNumber(value, #decimal places) Examples: FormatNumber(4567, 4)4,567.0000 FormatNumber(45678.473, 1)45,678.5 FormatNumber(4567.243, 0)4,567 Skip: bottom section of p. 139 & top p. 140 Next several slides show values as arguments as examples; use variable names in real programs to avoid magic numbers.

5 Chapter 3 Part 25 FormatCurrency Function Default Format: Dollar sign Rounds to 2 decimal places. Examples: FormatCurrency(87321.784)$87,321.78 FormatCurrency(44)$44.00 FormatCurrency(3.658)$3.66

6 Chapter 3 Part 26 FormatPercent Function Default Format: Multiplies argument by 100 Rounds to 2 decimal places Displays percent sign Examples: FormatPercent(.783)78.30% FormatPercent(.48129)48.13% FormatPercent(55)5,500.00% FormatPercent(.3862, 1)38.6%

7 Chapter 3 Part 27 FormatDateTime Syntax FormatDateTime(expression [, Format]) Examples: FormatDateTime(systemDate, DateFormat.LongDate) Wednesday, September 17, 2003 FormatDateTime(systemDate, DateFormat.ShortDate) 9/17/03

8 Chapter 3 Part 28 FormatDateTime More Examples FormatDateTime(systemDate, DateFormat.LongTime) 03:22:18 PM FormatDateTime(systemDate, DateFormat.ShortDate) 15:22 FormatDateTime(systemDate, DateFormat.GeneralDate) 09/17/2003 3:22:18 PM

9 Chapter 3 Part 29 Label Formats Properties Set TextAlign for values (typically right). Code lblTotal.Text = FormatCurrency(Total)

10 Chapter 3 Part 210 Formatted Text and Captions

11 Chapter 3 Part 211 GroupBox Control (p. 144) Appears as a rectangular border with an optional title in the upper-left corner. Contains and organizes controls.

12 Chapter 3 Part 212 GroupBox Creation Process 1. Create GroupBox control first. 2. Select the GroupBox. 3. Double-click controls from toolbox to appear within the GroupBox. Other controls are part of GroupBox and move with it.

13 Chapter 3 Part 213 GroupBox Control Moving Existing Controls to It 1. Select existing control(s). 2. Cut the selected control(s). 3. Select the GroupBox control. 4. Paste the selected control(s).

14 Chapter 3 Part 214 GroupBox TabIndex Set GroupBox control with Tab Order. Click controls inside GroupBox to provide tab order for those controls.

15 Chapter 3 Part 215 GroupBox Access Keys GroupBox itself cannot have focus. You can use & to set an access key. When a person uses the access key, the focus moves to the control with the lowest TabIndex value inside the GroupBox control.

16 Chapter 3 Part 216 Form Formatting (pp. 146-147) Selecting and Moving Multiple Controls Click and drag a selection box around the controls. Press Ctrl as you click controls.

17 Chapter 3 Part 217 Format Menu (Review) Align (p. 148) Lefts Rights Centers Horizontal Alignment Size (p. 149) Make Same Size

18 Chapter 3 Part 218 Form Load Executes when the form loads into memory. Example: declaring object variable to create instance of splash screen form (see Chapters 7 and 8) Double-click form to see Form Load event procedure.

19 Chapter 3 Part 219 Section 3.7 Program Development Complete Section 3.7 to develop the Highlander Hotel program. Note design sketches (pp. 150-151). Study control planning grids, including Methods (pp. 151-153). Follow flowcharts (pp. 154-155). Hint: Study flowchart shapes in case you see a test question. Complete Tutorial 3-10 (pp. 156-161).

20 Chapter 3 Part 220 Color Changes in Code (p. 159) ForeColor and BackColor Properties Color.Black Color.Red Color.Blue lblOutput.ForeColor = Color.Blue

21 Chapter 3 Part 221 Logic Errors (p. 162) Mistake that does not prevent a program from running BUT causes the program to produce inaccurate results. Examples: Mathematical errors Copying value to the wrong variable Incorrect assignment of constant values.

22 Chapter 3 Part 222 Debugging Logic Errors Read through Section 3.8. Complete Tutorial 3-12 (pp. 162-167). Set a breakpoint—line selected in code.

23 Chapter 3 Part 223 Checkpoints for Individual Review page 144 pages 149 and 150 page 168 Answers at end of book

24 Chapter 3 Part 224 Additional Review Summary Review Questions Fill-in-the-blank True or False Multiple Choice Short Answer What Do You Think? Find the Error Algorithm Workbench Answers on ftp site.


Download ppt "Chapter 3 Part 21 Displaying Output Chapter 3 Section 3.5Output Formatting Chapter 3 Section 3.6Group Boxes, etc. Chapter 3 Section 3.7Sample Program Chapter."

Similar presentations


Ads by Google