0% found this document useful (0 votes)
60 views4 pages

Data Types: CASTRO, Emmanuel G. (COE 221L 2:35-4 PM MWF) September 26, 2011

1) The document discusses data types in Visual Basic 2005, including examples of different data types like Boolean, Byte, Char, and their storage requirements. 2) It also covers functions in Visual Basic 2005 like Edit and Continue, My pseudo-namespace, and improvements for .NET 2.0 features like generics and partial classes. 3) A comparison is made between Visual Basic 2005 Express, VB6, and Visual Basic 2008 Express, noting changes to data types and differences moving from an object-based to object-oriented language in the .NET Framework.

Uploaded by

Charlene Claire
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views4 pages

Data Types: CASTRO, Emmanuel G. (COE 221L 2:35-4 PM MWF) September 26, 2011

1) The document discusses data types in Visual Basic 2005, including examples of different data types like Boolean, Byte, Char, and their storage requirements. 2) It also covers functions in Visual Basic 2005 like Edit and Continue, My pseudo-namespace, and improvements for .NET 2.0 features like generics and partial classes. 3) A comparison is made between Visual Basic 2005 Express, VB6, and Visual Basic 2008 Express, noting changes to data types and differences moving from an object-based to object-oriented language in the .NET Framework.

Uploaded by

Charlene Claire
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CASTRO, Emmanuel G.

(COE 221L 2:35-4 pm MWF ) September 26, 2011


VISUAL BASIC 2005 EXPRESS -data types -functions -compare it to VB6, 2008 Express

Data Types
Visual Basic is capable of storing and working with many different data types. Table 5.1 lists each of the data types supported by Visual Basic.

Data Type

Table 5.1: Visual Basic Supported Data Types Storage Value Range Requirements (in Bytes) True or False 0 to 255 0 to 65535 January 1,0001 to December 31, 9999 0 to +/- 79,228,162,514,264,337,593,543,950,335 -1.79769313486231570E+308 to - 4.94065645841246544E-324 for negative number and 4.94065645841246544E-324 to 1.79769313486231570E+308 for positive numbers -2,147,483,648 to 2,147,483,647 -2,147,483,648 to 2,147,483,647 Any type of variable -128 to 127 -32,768 to 32,767 -3.402823E+38 to -1.401298E-45 for negative numbers and 1.401298E-45 and 3.4028235E+E38 for positive numbers Up to two billion characters 0 to 4,294,967,295 0 to 18,446,744,073,709,551,615 0 to 65,535 1 2 8 8

Boolean 2 Byte Char Date Double

Decimal 16

Integer Long Object Sbyte Short Single String Ulong UShort

4 8 4 1 2 4 Varies 8 2

Ulnteger 4

As Table 5.1 shows, Visual Basic supports a large collection of data types. Each data type, except the object data type, is capable of storing a specific type of data. As Table 5.1 also shows, the amount of memory required to store data varies based on its data type. Visual Basic is very flexible. If you don't tell Visual Basic what the data type is for a particular piece of data, it assigns the data a default data type of Object .

Trap Although convenient , using the Object data type is not the most efficient option and will cause your application toconsume additional memory. Although a variable with a data type of Object can store any type of value, it cannot do so as efficiently as a variable that has been assigned the correct data type. Therefore, I strongly recommend that you always specify the data type for your variables. Just make sure when you do so that you specify a data type that accurately matches the type of data to be stored and that is capable of handling the size of the data to be stored. Trick When you specify the correct data types, you set up your Visual Basic programs to run faster by reducing the amount of memory used by the application and by eliminating the need to later convert data from one data type to another. However, I wouldn't invest too much time in analyzing the optimum data type for every variable that you ever need to create. In most cases, you can strike a good balance between program efficiency and memory usage versus your development time by using String, Integer, Double, Boolean , and Date .
By specifying a data type, you tell Visual Basic what range of values are allowable for a variable as well as what actions can be performed on the variable. For example, by specifying one of the numeric data types, you tell Visual Basic that it can perform mathematic calculations using the variable.

FUNCTIONS
Visual Basic 2005 is the name used to refer to the Visual Basic .NET, Microsoft having decided to drop the .NET portion of the title. For this release, Microsoft added many features, including:

Edit and Continue Design-time expression evaluation. The My pseudo-namespace (overview, details), which provides:

easy access to certain areas of the .NET Framework that otherwise require significant code to access dynamically-generated classes (notably My.Forms)

Improvements to the VB-to-VB.NET converter[2] The Using keyword, simplifying the use of objects that require the Dispose pattern to free resources

Just My Code, which when debugging hides (steps over) boilerplate code written by the Visual Studio .NET IDE and system library code Data Source binding, easing database client/server development

The above functions (particularly My) are intended to reinforce Visual Basic .NET's focus as a rapid application development platform and further differentiate it from C#. Visual Basic 2005 introduced features meant to fill in the gaps between itself and other "more powerful" .NET languages, adding:

.NET 2.0 languages features such as:


generics[3] Partial classes, a method of defining some parts of a class in one file and then adding more definitions later; particularly useful for integrating user code with auto-generated code

Nullable Types[4]

Support for unsigned integer data types commonly used in other languages

VISUAL BASIC 2005 EXPRESS vs VB6 vs 2008 EXPRESS

Relation to older versions of Visual Basic (VB6 and previous)


Whether Visual Basic .NET should be considered as just another version of Visual Basic or a completely different language is a topic of debate. This is not obvious, as once the methods that have been moved around and that can be automatically converted are accounted for, the basic syntax of the language has not seen many "breaking" changes, just additions to support new features like structured exception handling and short-circuited expressions. Two important data type changes occurred with the move to VB.NET. Compared to VB6, theInteger data type has been doubled in length from 16 bits to 32 bits, and the Long data type has been doubled in length from 32 bits to 64 bits. This is true for all versions of VB.NET. A 16-bit integer in all versions of VB.NET is now known as a Short. Similarly, the Windows Forms GUI editor is very similar in style and function to the Visual Basic form editor. The version numbers used for the new Visual Basic (7, 7.1, 8, 9, ...) clearly imply that it is viewed by Microsoft as still essentially the same product as the old Visual Basic. The things that have changed significantly are the semanticsfrom those of an object-based programming language running on adeterministic, reference-counted engine based on COM to

a fully object-oriented language backed by the .NET Framework, which consists of a combination of the Common Language Runtime (a virtual machine using generational garbage collection and a just-in-time compilationengine) and a far larger class library. The increased breadth of the latter is also a problem that VB developers have to deal with when coming to the language, although this is somewhat addressed by the My feature in Visual Studio 2005. The changes have altered many underlying assumptions about the "right" thing to do with respect to performance and maintainability. Some functions and libraries no longer exist; others are available, but not as efficient as the "native" .NET alternatives. Even if they compile, most converted VB6 applications will require some level of refactoring to take full advantage of the new language. Documentation is available to cover changes in the syntax, debugging applications, deployment and terminology.

Visual Basic 2008 (VB 9.0)


Visual Basic 9.0 was released together with the Microsoft .NET Framework 3.5 on 19 November 2007. For this release, Microsoft added many features, including:

A true conditional operator, "If(condition as boolean, truepart, falsepart)", to replace the "IIf" function. Anonymous types Support for LINQ Lambda expressions XML Literals Type Inference Extension methods

You might also like