microsoft visual basic 2015 chapter 04

67 53 0
 microsoft  visual basic 2015 chapter 04

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Microsoft Visual Basic 2015 CHAPTER FOUR Variables and Arithmetic Operations Objectives ►Create, modify, and program a TextBox object ►Use code to place data in the Text property of a Label object ►Use the AcceptButton and CancelButton properties ►Understand and declare String and Numeric variables ►Use assignment statements to place data in variables Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Objectives ►Use literals and constants in coding statements ►Understand scope rules for variables ►Convert string and numeric data ►Understand and use arithmetic operators and arithmetic operations Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Objectives ►Format and display numeric data as a string ►Create a form load event ►Create a concatenated string ►Debug a program Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 4 Introduction Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part TextBox Objects ►With Visual Studio open, the Desktop application created, and the [Design] tabbed page visible, point to the TextBox NET component in the Toolbox ►Drag the TextBox NET component onto the Windows Form object at the desired location ►When the upper-left corner of the pointer is located where you want the TextBox object’s upper-left corner, release the left mouse button Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part TextBox Objects Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Sizing and Positioning a TextBox Object ► Select the TextBox object Select the (Name) property and type the desired name Scroll in the Properties window until the Text property is visible and then tap or click the right column for the Text property ► Type the maximum number of characters the user normally will enter into the text box and then press the ENTER key Programmers often use the digit in this situation because it is wider than other digits Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Sizing and Positioning a TextBox Object ►Using the Properties window, change the Font property to the correct font and font size Then, drag the right edge of the TextBox object and resize it to be slightly wider than the entry ►To horizontally align the text in the label and the text in the text box, drag the text box up until a red snap line indicates the bottoms of the text are aligned Then, release the left mouse button Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Sizing and Positioning a TextBox Object Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 10 Clearing the Text Property of a Label ►The Clear procedure cannot be used with a Label object ►You must write an assignment statement that assigns a null length string to the Text property Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 53 Setting the Focus ►When the focus is on a TextBox object, the insertion point is located in the text box Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 54 Form Load Event ►A form load event occurs when the program starts and Windows Form Object is loaded into computer memory Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 55 Concatenation ►The process of joining two different values into a single string is called concatenation ►The values being concatenated must be String data types Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 56 Concatenation Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 57 Class Scope ►When a variable is referenced in two different event handling procedures, it must be defined at the class level instead of the procedure (event handler) level Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 58 Debugging Your Program ►A Format Exception occurs when the user enters data that a statement within the program cannot process properly Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 59 Debugging Your Program ►An Overflow Exception occurs when the user enters a value greater than the maximum value the statement can process ►It is not possible to divide by zero, so if your program contains a division operation and the divisor is zero, the Divide By Zero Exception will occur Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 60 Program Design Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 61 Program Design Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 62 Event Planning Document Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 63 Summary ►Create, modify, and program a TextBox object ►Use code to place data in the Text property of a Label object ►Use the AcceptButton and CancelButton properties ►Understand and declare String and Numeric variables ►Use assignment statements to place data in variables Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 64 Summary ►Use literals and constants in coding statements ►Understand scope rules for variables ►Convert string and numeric data ►Understand and use arithmetic operators and arithmetic operations Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 65 Summary ►Format and display numeric data as a string ►Create a form load event ►Create a concatenated string ►Debug a program Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 66 Microsoft Visual Basic 2015 CHAPTER FOUR COMPLETE Variables and Arithmetic Operations ... list Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part 21 Visual. .. ►Convert string and numeric data ►Understand and use arithmetic operators and arithmetic operations Chapter 4: Variables and Arithmetic Operations â 2016 Cengage Learningđ May not be scanned, copied... numeric data as a string ►Create a form load event ►Create a concatenated string ►Debug a program Chapter 4: Variables and Arithmetic Operations © 2016 Cengage Learning® May not be scanned, copied

Ngày đăng: 06/02/2018, 10:06

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan