RESOLVED two simple questions that i don't know - data types

merciless

New member
Joined
Mar 2, 2005
Messages
4
Programming Experience
Beginner
1. What is the difference between Integer type data and Long type data

2. What is the difference between Single type data and Double type data.



Thanks
 
Last edited:
Short Integers = 16 bits - max value of about 32676
Integers = 32 bits - much bigger numbers allowed
Long Integer = 64bits - good for values of really BIG numbers.

Tg
 
Single has floating point accuracy to 6 digits
Double has floating point accuracy to 14 points

Short integer holds values between -32,768 to 32,767
Integer holds between -2,147,483,648 to 2,147,483,647
Long holds any other larger number
 
It should be noted that using the smalles data type necessary for it's use is good programming practice. Using a Long for someone's age is just unecessary and a waste of RAM.

Is the Byte data type still available in VB.NET? I haven't been using .NET long enough to have used it.
 
yes:

VB.NET:
Data Types:
Boolean
Byte (0 to 255)
Char
Date
String
Decimal
Object
Short (-32,768 to 32,767)
Integer (-2,147,483,648 to 2,147,483,647)
Long (larger whole numbers)
Single (floating point accuracy to 6 digits)
Double (floating point accuracy to 14 points)


Data Types – Memory Usage:
Boolean – 2 bytes
Byte	– 1 byte
Char	– 2 bytes
Date	– 8 bytes
String  – varies
Decimal – 16 bytes
Object  – 4 bytes
Short   – 2 bytes
Integer – 4 bytes
Long	– 8 bytes
Single  – 4 bytes
Double  – 8 bytes


Data Types – Prefixes:
Boolean – bln
Byte	– byt
Char	– chr
Date	– dat
String  – str
Decimal – dec
Object  – depends on type of object
Short   – sht
Integer – int
Long	– lng
Single  – sng
Double  – dbl

Type-Declaration Characters:
Append single character to the end of the Constant's Value to indicate the Data Type

Short   – S
Integer – I
Long	– L
Decimal – D 
Single  – F
Double  – R

Variables – Scope & Lifetime:
Global/Public (use sparingly and cautiously)
  -Available to all modules and procedures of Project
  -Initialized at start of Project
Module/Private		(Form)
  -Available to one module and all procedures within that module
  -Initialized 1st time the Form is loaded
Local
  -Available only to the procedure it is declared in
  -Initialized every time the Procedure runs
Block (Try/Catch, For/Next, Do/While, etc)
  -Available only to the block of code inside a procedure it is declared in
  -Initialized every time the Procedure runs

Scope Declaring & Naming:
Global/Public				g prefix
  -Declare in General Declarations as Public
  -Public/Friend gstrName as String
Module/Private			m prefix
  -Declare in Module’s General Declarations as Private
  -Private mstrName as String
Local				no prefix required
  -Declare in Event Procedures
  -Dim strName as String
 
Back
Top