![EBK 3N3-EBK: PROGRAMMING W/MICROSOFT VI](https://www.bartleby.com/isbn_cover_images/9780176920159/9780176920159_largeCoverImage.gif)
EBK 3N3-EBK: PROGRAMMING W/MICROSOFT VI
8th Edition
ISBN: 9780176920159
Author: ZAK
Publisher: VST
expand_more
expand_more
format_list_bulleted
Question
Chapter 3, Problem 2MQ6
Program Plan Intro
ToString Method:
The method ToString() is used to convert the number to string. All the numeric data types use ToString() method for this conversion. This method allows the user to format the value such as specifying the decimal places and adding special characters to the string which is to be displayed.
The ToString() methods formats the copy of value present in the numeric variable and then returns the result as string value.
Syntax:
numericVariableName.ToString(formatString)
- The numericVariableName is the variable name.
- The parameter formatString is used to format the variable’s value.
- The formatString string should be in the form of “Axx”.
- “A” represents the build format specifier and “xx” specifies the precision of the digits.
- The format specifier can be in upper case letter or lower case letter.
- The formatString string should be in the form of “Axx”.
The following table represents the list of format specifiers available in visual basic:
Format specifier | Description |
C or c (Currency) | It displays the string with dollar sign and included with a thousand separators. Negative values enclosed with parentheses. |
N or n (Number) | It displays the string with a thousand separators but not include a dollar sign. Negative values preceded by minus sign. |
F or f (Fixed-point) | It displays the string without thousand separator and dollar sign. Negative values preceded by minus sign. |
P or p (Percent) | It multiplies the number by 100 and displays the result with percentage sign and negative values preceded by minus sign. |
Expert Solution & Answer
![Check Mark](/static/check-mark.png)
Want to see the full answer?
Check out a sample textbook solution![Blurred answer](/static/blurred-answer.jpg)
Students have asked these similar questions
Write a statement that displays the dblRate variable’s value in the lblRate.Text property. The value should contain a percent sign and no decimal places.
Write a statement that displays the decPrice variable’s value in the lblPrice.Text property. The value should contain a dollar sign and two decimal places.
Write a statement that displays the intQuantity variable’s value in the lblQuantity.Text property.
Chapter 3 Solutions
EBK 3N3-EBK: PROGRAMMING W/MICROSOFT VI
Ch. 3 - Prob. 1MQ1Ch. 3 - Prob. 2MQ1Ch. 3 - Prob. 3MQ1Ch. 3 - Prob. 4MQ1Ch. 3 - Prob. 5MQ1Ch. 3 - Which of the following are valid names for...Ch. 3 - Prob. 1MQ2Ch. 3 - Prob. 2MQ2Ch. 3 - Write a Dim statement that declares a Boolean...Ch. 3 - Prob. 1MQ3
Ch. 3 - Prob. 2MQ3Ch. 3 - Prob. 3MQ3Ch. 3 - Write a TryParse method that stores the strSales...Ch. 3 - Prob. 1MQ4Ch. 3 - Prob. 2MQ4Ch. 3 - Prob. 3MQ4Ch. 3 - Prob. 4MQ4Ch. 3 - Prob. 5MQ4Ch. 3 - Prob. 1MQ5Ch. 3 - Prob. 2MQ5Ch. 3 - Prob. 3MQ5Ch. 3 - Prob. 4MQ5Ch. 3 - Prob. 1MQ6Ch. 3 - Prob. 2MQ6Ch. 3 - Prob. 3MQ6Ch. 3 - Prob. 4MQ6Ch. 3 - Prob. 5MQ6Ch. 3 - Prob. 1MQ7Ch. 3 - Prob. 2MQ7Ch. 3 - Prob. 3MQ7Ch. 3 - Prob. 4MQ7Ch. 3 - Prob. 1MQ8Ch. 3 - Prob. 2MQ8Ch. 3 - Prob. 3MQ8Ch. 3 - Prob. 4MQ8Ch. 3 - Prob. 1MQ9Ch. 3 - Prob. 2MQ9Ch. 3 - Prob. 3MQ9Ch. 3 - Prob. 1RQCh. 3 - Prob. 2RQCh. 3 - What is the result of the following expression: 96...Ch. 3 - Which of the following is an invalid name for a...Ch. 3 - The expression intNum * intNum * intNum is...Ch. 3 - What is the result of the following expression: 3...Ch. 3 - Prob. 7RQCh. 3 - Which of the following statements declares a...Ch. 3 - Which of the following can be used to clear the...Ch. 3 - Prob. 10RQCh. 3 - Which of the following declares a procedure-level...Ch. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Prob. 14RQCh. 3 - Prob. 15RQCh. 3 - Prob. 16RQCh. 3 - A static variable has the same...Ch. 3 - Prob. 18RQCh. 3 - Which of the following statements declares a...Ch. 3 - Most of the memory locations declared in an...Ch. 3 - Prob. 1ECh. 3 - Prob. 2ECh. 3 - Prob. 3ECh. 3 - Prob. 14E
Knowledge Booster
Similar questions
- Write a statement that displays the following numeric variables in amessage box. grandTotalarrow_forwardWrite an assignment statement that increments the intTotal variable by the contents of the intQuantity variable.arrow_forwardThe dblBonus variable contains the number 1234.75. Write the assignment statement to display the value with a dollar sign, a thousands separator, and no decimal places in the lblBonus control.arrow_forward
- Create a variable called NUMBER and assign the value 9 to it 2. Create an IF statement that will print out Correct IF the NUMBER is greater than 8 3. IF the NUMBER is less than 8 nothing is printed 4. Test the code to make sure it works. Make sure to test a number greater than 8 and less than 8 5. Copy the code into the submission box Not an assignment.arrow_forwardWrite an assignment statement that concatenates the message “She lives in ” with the contents of the strCity variable, and then assigns the result to the lblCity control.arrow_forwardThe strItem variable contains the string “XMredBQ”. Write a statement that uses the Substring method to assign the string “red” to the strColor variable.arrow_forward
- Make a statement that displays the letterGrade char variable's value in a message box.arrow_forwardWrite an assignment statement that increments the intNumEmployees variable by 1.arrow_forwardIf you need to validate a value before assigning it to a Private variable, you enter the validation code in which block in a Property procedure? a. Assign b. Get c. Set d. Validatearrow_forward
- If the decPay variable contains the number 1200.76, which of the following statements displays the number as 1,200.76? a. lblPay.Text = decPay.ToString("N2") b. lblPay.Text = decPay.ToString("F2") c. lblPay.Text = decPay.ToString("D2") d. lblPay.Text = decPay.ToString("C2")arrow_forwardAssume pointsTextBox is the name of a TextBox control and points is the name of an int variable. Write an if-else statement that uses one of the TryParse methods to convert the pointsTextBox control’s Text property to an int and stores the result in the points variable. If the conversion is not successful, display an error message in a message box.arrow_forwardA condition such as "pcount < 20" has a _____value. numeric alphanumeric characte booleanarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning