1 / 15

Tutorial 6

Tutorial 6. Introducing Variables, Memory Concepts & Arithmetic. Variables. Holds data Controls for Design Programming, Variables for Code Programming Text Property  Data  Variable Manipulate data w/o showing to users Store data w/o adding or using controls

tasya
Download Presentation

Tutorial 6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tutorial 6 Introducing Variables, Memory Concepts & Arithmetic

  2. Variables • Holds data • Controls for Design Programming, Variables for Code Programming • Text Property  Data  Variable • Manipulate data w/o showing to users • Store data w/o adding or using controls • Hold numbers, data & time, text, and etc. Continue 

  3. One type of variable can take the same type of data. E.g. • intCount = 15 (OK) • intCount = “Pat” (not OK) • intCount = “15” (not OK) • Must be declared. E.g. • Dim intCount As Integer • Dim sngPrice As Single Continue 

  4. Steps of Using Variables • Declare • Input: Assign a value by reading in from a control or other source • Process: Use or manipulate • Output: Put the value to a control or other object

  5. Example 1: Dim intTotal As Integer intTotal = Val(txtTotal.Text) intTotal = intTotal + 10 txtTotal.Text = Str(intTotal)

  6. Example 2: Dim intTotal As Integer Dim intExtra As Integer intTotal = Val(txtTotal.Text) intExtra = 10 intTotal = intTotal + intExtra txtTotal.Text = Str(intTotal)

  7. Example 3: Dim intTotal As Integer Dim intExtra As Integer = 10 intTotal = Val(txtTotal.Text) intTotal = intTotal + intExtra txtTotal.Text = Str(intTotal)

  8. Data Types of Variables

  9. Integer • Stored as 32-bit (4-byte) integers ranging in value from -2,147,483,648 through 2,147,483,647. • Provides optimal performance on a 32-bit processor, as the smaller integral types are slower to load and store from and to memory. • You can convert the Integer data type to Long, Single, Double, or Decimal without encountering a System.OverflowException error.

  10. Single • Stored as IEEE 32-bit (4-byte) single-precision floating-point numbers ranging in value from -3.4028235E+38 through -1.401298E-45 for negative values and from 1.401298E-45 through 3.4028235E+38 for positive values. Single-precision numbers store an approximation of a real number. • Can be converted to the Double or Decimal data type without encountering a System.OverflowException error.

  11. String • Stored as sequences of 16-bit (2-byte) numbers ranging in value from 0 through 65535 • Each number represents a single Unicode character. A string can contain up to approximately 2 billion (2 ^ 31) Unicode characters • The first 128 code points (0–127) of Unicode correspond to the letters and symbols on a standard U.S. keyboard • The second 128 code points (128–255) represent special characters, such as Latin-based alphabet letters, accents, currency symbols, and fractions • The remaining code points are used for a wide variety of symbols

  12. Prefixes for Variables

  13. Arithmetic Operators Continue 

  14. Using Debugger • Demo

More Related