Download presentation
Presentation is loading. Please wait.
Published byBailey Clee Modified over 10 years ago
1
Ch. 3 Variables VB.Net Programming
2
Data Types Boolean – True or False values Short – Small integers (+/- 32,767) Integer – Medium-size integers (+/- 2 billion) Long – Large integers (+/- 9E+18) Single – Less accurate decimals (6 digits of precision) Double – More accurate decimals (10 digits of precision) Decimal –Generic decimals String – Words and numbers not used in calculations
3
Declaring Variables and Constants Variable – a named memory location that is used to store a value that can be changed during run time To declare a variable: Dim VarName As DataType = InitialValue (Initial Value is optional) Constant – a named memory location that is used to store a value that cannot be changed during run time To declare a constant: Const ConstName As DataType = Value
4
Formatting Numeric Output VarName.ToString(“FormatSpecifierPrecisionSpecifier”) See page 101 in your textbook for a full list. Example of currency formatting: VarName.ToString(“C”) VarName will be displayed with a $ sign and two decimal places. Example of rounding to 2 decimal places: VarName.ToString(“F2”)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.