Menu

Data types, variables, constants and conversions (VB.NET)
πŸ“°

Data types, variables, constants and conversions (VB.NET)

DEV Community: dotnetΒ·DIVAKAR UPADHYAYΒ·about 20 hours ago
#3FrJ24ei
#devtodotnet#devto#dev#string#integer
Reading 0:00
15s threshold

πŸ‘‰ Full lesson with practice questions on DevLadder (free, lesson 2 of 12 in the VB.NET: Visual Basic .NET from Basics to Advanced (with C# Comparison) course)

VB.NET C# .NET type Literal

Integer int Int32 42 , 42I

Long long Int64 42L

Short / Byte short / byte Int16 / Byte 42S

Double / Single double / float Double / Single 1.5R / 1.5F

Decimal decimal Decimal 1.5D

Boolean bool Boolean True / False

Char char Char "A"c

String string String "text"

Date DateTime DateTime #10/24/2026# (M/d/yyyy)

Object object Object

Dim count As Integer = 10 Dim price = 99.5D ' Decimal, inferred with Option Infer On Const TaxRate As Decimal = 0.18D Dim total As Decimal = price * ( 1 + TaxRate ) Dim nothingYet As String = Nothing ' Nothing = C# null (or default for value types) Dim maybe As Integer ? = Nothing ' Nullable(Of Integer)

' Conversions Dim n1 As Integer = CInt ( "42" ) ' VB conversion keyword (rounds to even for decimals: CInt(2.5) = 2) Dim n2 As Integer = Integer .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.