Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants,

Similar presentations


Presentation on theme: "© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants,"— Presentation transcript:

1 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants, and Calculations

2 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 2 Formatting Numbers for Output Numbers May Be Formatted in Various Ways for Output

3 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 3 FormatNumber Function FormatNumber(expression [, DecimalPoints]) The expression is evaluated and output as a number The optional second argument gives the number of requested decimal places

4 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 4 FormatCurrency Function FormatCurrency(expression [, DecimalPoints]) The expression is evaluated and output as a currency value based on your PCs local options The optional second argument gives the number of requested decimal places

5 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 5 FormatPercent Function FormatPercent(expression [, DecimalPoints]) The expression is evaluated and output as a percentage value The optional second argument gives the number of requested decimal places

6 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 6 FormatDateTime Function FormatDateTime(expression [, Format]) The expression is evaluated and output as a date and time value based on Format The optional second argument gives the requested format, e.g.  DateFormat.GeneralDate  DateFormat.LongDate  Etc.

7 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 7 Group Boxes, Form Formatting, and the Load Event Procedure In This Section We Discuss the GroupBox Control, Which Is Used to Group Other Controls, and How to Align and Center Controls on a Form

8 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 8 Group Box A Group Box creates a Logical and Physical grouping of controls  Physical: They are surrounded by a box and have a title  Logical: The controls within the box have a tab ordering within the Group box

9 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 9 Placing Controls within a Group Box Select the Group Box then double click a control to add to the group, or Select the Group Box then click the desired tool in the toolbox and draw the control inside the Group Box, or Cut a control, select the Group Box, and then paste the control

10 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 10 Form Formatting, I The form defaults to an 8x8 "snap to" grid This can be modified by going to Tools/Options and then selecting "Windows Forms Designer"  Modify the granularity of the grid  Show the grid or not  Either use "snap to" or not Multiple controls can be selected simultaneously by:  Click and dragging an area and/or  Ctrl-Clicking individual objects

11 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 11 Form Formatting, II Once selected controls may be organized via:  Align lefts  Align centers  Align rights  Align tops  Align middles  Align bottoms Other submenu operations include:  Same Size  Horizontal and Vertical Spacing  Center in Form  Order

12 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 12 Load Event Procedure Every form has a Load event procedure It is executed each time the form loads into memory Need to execute some code at that time: Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles MyBase.Load ' Code to be executed when the Form loads End Sub

13 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 13 More About Debugging: Locating Logic Errors Visual Basic.NET Allows You to Pause a Program, Then Execute Its Statements One at a Time After Each Statement Executes, You May Examine Variable Contents and Property Values

14 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 14 Debugging Problem The program does not work correctly (has one or more logic errors) Running the program with various inputs has not isolated where those logic errors are hiding What can be done?

15 © 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 15 Visual Basic.NET Debugging Aids Single Step through the program This amounts to executing the program a statement at a time One can then see and examine:  What is happening one statement at a time  Where it is happening  What the various data values are (Watches) Related debugging tools include  Executing to a breakpoint (placed just before you think the program's logic error may be)  Examining the values of expressions


Download ppt "© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants,"

Similar presentations


Ads by Google