VB.Net Data Types and Variable Declaration with DIM
VB.Net Data Types refers to a type of data that any variable can store in vb.net. This variable belongs to different data types and determines how much space it occupies in storage memory allocated. VB.Net Data Types includes include the following.
What are Data Types in VB.Net?
VB.Net Data Types
- Boolean
The storage allocation depends on the implementing platform. The default values for VB.Net Data Type Boolean is TRUE or FALSE.
- Byte
Values range from 0 to 255 (unsigned).
- Char
Values range from 0 to 65535 (unsigned).
- Date
The storage space is 8 bytes. Values range from 0:00:00 (midnight) on January 1, 0001 through 11:59:59 PM on December 31, 9999.
- Decimal
The storage space is 16 byte. From 0 through +/-79,228,162,514,264,337,593,543,950,335 (+/-7.9…E+28) with no decimal point; 0 through +/-7.9228162514264337593543950335 with 28 places to the right of the decimal
- Double
-1.79769313486231570E+308 through -4.94065645841246544E-324, for negative values
4.94065645841246544E-324 through 1.79769313486231570E+308, for positive values - Integer
has a storage space of 4 bytes. Values range between -2,147,483,648 to 2,147,483,647 (signed).
- Long
It has a storage space of 8 bytes. From -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807(signed)
- Short
It has a storage space of 2 bytes. -32,768 through 32,767 (signed)
- Single
It has a storage space of 4 bytes. -3.4028235E+38 through -1.401298E-45 for negative values;
1.401298E-45 through 3.4028235E+38 for positive values - String
The storage allocation depends on the implementing platform. Values from 0 to approximately 2 billion Unicode characters.
VB.NET Variables
What is a Variable? Variable is the most important in computer programming. All programming languages used variables to store and hold temporary data until it is released.
You will not appreciate the importance of variableS at this moment. But as you continue in programming you will realize what I’m talking about.
In declaring variables, the first thing that you have to do is to type the “Dim“.
See the Example below:
Dim name As String name = "Janry"
Here’s the example to display the value stored in a variable.
Dim name As String name = "Janry" MsgBox(name)
VB.Net Data Types and Variable Declaration with Dim in Actual Program.
In this section, we will now perform some of the most commonly used in the vb.net data type together with the use of vb.net variables using DIM for the declaration of VB.Net Variables.
Steps to Perform the VB.Net Data Types and variables
Step 1. Open Visual Studio and Create a new Project.

Step 2. Create a Windows Form Application. Follow the steps in the image below.

Step 3. Add a Button to Windows Form.

Step 4. Change the Text property of the button to “Test Variables”. Then Double click the Button and the Following Code.
Dim bool As Boolean
Dim bday As Date
Dim age As Integer
Dim money As Decimal
Dim str As StringThe code above is only a variable declaration with Dim. Dim means Dimension. If you are going to read the declaration, you say “The Dimension of variable name as Data Type”.
Step 5. Assign a value to a VB.Net variable. Add the following code.
bool = True
bday = Today
money = 9.5
age = 25
str = "Still I am Happy!"
Step 6. Display the result of using Messagebox. Add the following code.
MsgBox("The Boolean Value is set to :" & bool)
MsgBox("Today " & bday & "is my birthday!")
MsgBox("And I am now " & age & " Years old!")
MsgBox("And I only have " & money & " dollar in my pocket")
MsgBox(str)Step 7. Press “F5” to run the Project.
When you run the project and click the “Text Variable” button. you will see the following message box below.
Sample output of VB.NET using boolean

Sample output of VB.NET using Date

Sample output of VB.NET using Integer

Sample output of VB.NET using Decimal

Sample output of VB.NET using String

Summary
In summary, we have tackled VB.Net Data type and learn what would be the possible value of different data types when assigning to a specific vb.net variable.
For more examples, you may visit it guru99.com.
Frequently Asked Questions
How does this VB.NET project work?
Built with VB.NET WinForms (.NET Framework 4.5+) and SQL Server backend. Standard structure: Form designer to code-behind event handlers to ADO.NET data access layer to SQL Server. Login form for auth. Ready to extend for BSIT capstone scope.
What Visual Studio and SQL Server versions does this VB.NET project require?
Most projects use VB.NET WinForms on .NET Framework 4.5+ with SQL Server 2012 Express or higher. To run: install Visual Studio 2019 / 2022 (Community is free) with the ‘Desktop development with .NET’ workload, install SQL Server Express + SSMS, open the .sln file, build, run.
How do I set up the database for this VB.NET project?
Open SQL Server Management Studio (SSMS) and connect to your SQL Server (e.g. localhost\SQLEXPRESS). Right-click Databases, choose Restore Database OR New Database then import the included .sql script. Update the connection string in App.config (or in code-behind Module) with your server name + credentials. Rebuild and run.
Can I use this VB.NET project for a BSIT capstone or thesis?
Yes, VB.NET is one of the most accepted languages by Philippine BSIT panels. Extend it: add role-based access (admin/staff/customer login redirect), Crystal Reports or RDLC reports, dashboards with Chart control, audit log, multi-branch support. Pair with Chapter 1-5 documentation matching your panel’s rubric.
Why am I getting ‘connection error’ or ‘cannot find SQL Server’?
Three common VB.NET issues: (1) Connection error: SQL Server isn’t running. Open SQL Server Configuration Manager and verify SQL Server (SQLEXPRESS) service is started. (2) Wrong server name in connection string. Try .\SQLEXPRESS, (local)\SQLEXPRESS, or your machine name. (3) Login failed: SQL Server is set to ‘Windows-only’ authentication. Switch to Mixed Mode in SSMS Server Properties, Security.
Where can I find more VB.NET projects with source code?
Browse the VB.NET Projects hub for the full library. For C# WinForms alternatives see C# Projects. For ASP.NET web alternatives see ASP.NET Projects. For BSIT capstone idea lists see 150 Best Capstone Project Ideas.
Inquiries
If you have any questions or suggestions about this tutorial, please feel free to leave a comment below.
This tutorial is the continuation of our previous tutorial entitled VB.NET Tutorials for Beginners with Examples.
