Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft Visual Basic 2005 BASICS

Similar presentations


Presentation on theme: "Microsoft Visual Basic 2005 BASICS"— Presentation transcript:

1 Microsoft Visual Basic 2005 BASICS
yo Microsoft Visual Basic 2005 BASICS Lesson 7 Strings and Decimal Types

2 Objectives Declare string variables. Assign text to string variables.
yo Objectives Declare string variables. Assign text to string variables. Concatenate strings. Use decimal data types. Use the Format function. Microsoft Visual Basic 2005 BASICS

3 Objectives (cont.) Use the Enabled property.
yo Objectives (cont.) Use the Enabled property. Use the SelectionStart and SelectionLength properties. Microsoft Visual Basic 2005 BASICS

4 Declaring String Variables
yo Declaring String Variables Text is often called alphanumeric data. Can include letters or numbers Data types that hold text are usually referred to as strings. When you declare a string, the resulting variable can hold a string of any practical length. Microsoft Visual Basic 2005 BASICS

5 Assigning Text to String Variables
yo Assigning Text to String Variables Place the text in quotation marks. Hard-coded text is called a string literal. Like a numeric variable, a string variable can only hold one string. Each time you assign a string to a string variable, the existing data is replaced. Microsoft Visual Basic 2005 BASICS

6 Assigning Text to String Variables (cont.)
Microsoft Visual Basic 2005 BASICS

7 Assigning Text to String Variables (cont.)
Microsoft Visual Basic 2005 BASICS

8 Concatenation Concatenation Ampersand (&)
yo Concatenation Concatenation Appends one string to the end of another Ampersand (&) You can concatenate more than two strings in one expression. You can also use concatenation when creating the text for a label. Microsoft Visual Basic 2005 BASICS

9 Concatenation (cont.) Microsoft Visual Basic 2005 BASICS

10 Concatenation (cont.) Microsoft Visual Basic 2005 BASICS

11 Concatenation (cont.) Microsoft Visual Basic 2005 BASICS

12 Concatenation (cont.) Microsoft Visual Basic 2005 BASICS

13 Using Decimal Types Single data type Double data type
yo Using Decimal Types Single data type Used for decimal values that will not exceed 38 digits Double data type Used for decimal values with more than 38 digits Decimal data type Used to work with dollars and cents Microsoft Visual Basic 2005 BASICS

14 Using the Format Function
yo Using the Format Function The Format function Allows you to apply custom formatting to a number before displaying the value The Format function can be used to format decimal values, phone numbers, and more. Microsoft Visual Basic 2005 BASICS

15 Using the Format Function (cont.)
Microsoft Visual Basic 2005 BASICS

16 Using the Format Function (cont.)
Microsoft Visual Basic 2005 BASICS

17 Using the Format Function (cont.)
Microsoft Visual Basic 2005 BASICS

18 Using the Enabled Property
yo Using the Enabled Property Enabled property Makes a control take on a grayed appearance that makes it inactive but still visible Objects that are inactive can be seen by the user, but will not respond to user actions. Microsoft Visual Basic 2005 BASICS

19 Using the Enabled Property (cont.)
To disable an object, set the Enabled property to False. Microsoft Visual Basic 2005 BASICS

20 Using the SelectionStart and SelectionLength Properties
yo Using the SelectionStart and SelectionLength Properties SelectionStart property Specifies the location where the insertion point will be inserted when the text box gets the focus SelectionLength property Specifies how many characters should be selected to the right of the cursor Microsoft Visual Basic 2005 BASICS

21 Using the SelectionStart and SelectionLength Properties (cont.)
Microsoft Visual Basic 2005 BASICS

22 Summary Strings hold text or alphanumeric data.
yo Summary Strings hold text or alphanumeric data. Visual Basic has a data type for strings. Text assigned to a string variable must be placed in quotation marks. You can use the assignment operator to assign text from a text box to a string variable or from a string variable to another string variable. Microsoft Visual Basic 2005 BASICS

23 yo Summary (cont.) Concatenation is the process of appending one string to the end of another. The ampersand (&) is the symbol used for concatenation. The Single, Double, and Decimal data types hold decimal data. The Decimal data type is specially designed for handling dollars and cents. Microsoft Visual Basic 2005 BASICS

24 yo Summary (cont.) The Format function uses a string of symbols to format decimal values, phone numbers, and more. The Enabled property is used to make a control inactive or active. The SelectionStart and SelectionLength properties and the Len function can be used together to highlight the text in a text box. Microsoft Visual Basic 2005 BASICS


Download ppt "Microsoft Visual Basic 2005 BASICS"

Similar presentations


Ads by Google