Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VB.Net variable types
@echo off
set VBC="%WinDir%\Microsoft.NET\Framework64\v4.0.30319\vbc.exe"
set VBCFLAGS=-nologo -quiet -utf8output -rootnamespace:GetVBVariableInfo -target:exe
set VBFILES=GetVBVariableInfo.vb
%VBC% %VBCFLAGS% -out:GetVBVariableInfo.exe %VBFILES%
if Not ERRORLEVEL==1 goto EOF
echo VBC command failed, trying again in 32-bit folder...
set VBC="%WinDir%\Microsoft.NET\Framework\v4.0.30319\vbc.exe"
%VBC% %VBCFLAGS% -out:GetVBVariableInfo.exe %VBFILES%
:EOF
Module GetVBVariableInfo
Sub Main(args As String())
Print(" Variable Type:", " MinValue:", " MaxValue:")
Print("Char:", Char.MinValue, Char.MaxValue)
Print("Boolean:", Boolean.FalseString, Boolean.TrueString)
Print("Byte:", Byte.MinValue, Byte.MaxValue)
Print("UShort:", UShort.MinValue, UShort.MaxValue)
Print("UInt16:", UInt16.MinValue, UInt16.MaxValue)
Print("UInteger:", UInteger.MinValue, UInteger.MaxValue)
Print("UInt32:", UInt32.MinValue, UInt32.MaxValue)
Print("ULong:", ULong.MinValue, ULong.MaxValue)
Print("UInt64:", UInt64.MinValue, UInt64.MaxValue)
Print("SByte:", SByte.MinValue, SByte.MaxValue)
Print("Short:", Short.MinValue, Short.MaxValue)
Print("Int16:", Int16.MinValue, Int16.MaxValue)
Print("Integer:", Integer.MinValue, Integer.MaxValue)
Print("Int32:", Int32.MinValue, Int32.MaxValue)
Print("Long:", Long.MinValue, Long.MaxValue)
Print("Int64:", Int64.MinValue, Int64.MaxValue)
Print("Decimal:", Decimal.MinValue, Decimal.MaxValue)
Print("Single:", CDbl(Single.MinValue).ToString("F0"), CDbl(Single.MaxValue).ToString("F0"))
Print("Double:", Double.MinValue, Double.MaxValue)
Console.WriteLine("DoubleMinValueFull: " & Double.MinValue.ToString("F0"))
Console.WriteLine("DoubleMaxValueFull: " & Double.MaxValue.ToString("F0"))
End Sub
Sub Print(varName As String, MinValue As String, MaxValue As String)
Console.WriteLine(varName.PadRight(19) & MinValue.PadRight(50) & MaxValue)
End Sub
End Module
VBC = vbnc
VBCFLAGS = -nologo -quiet -utf8output -rootnamespace:GetVBVariableInfo -target:exe
VBFILES = GetVBVariableInfo.vb
GetVBVariableInfo: $(VBFILES)
$(VBC) $(VBCFLAGS) -out:GetVBVariableInfo $(VBFILES)
release: GetVBVariableInfo
mv GetVBVariableInfo GetVBVariableInfo.exe
clean:
$(RM) GetVBVariableInfo
$(RM) GetVBVariableInfo.exe
$(RM) -r bin
# in case you had been using MonoDevelop
all: GetVBVariableInfo
$ make && mono GetVBVariableInfo
vbnc -nologo -quiet -utf8output -rootnamespace:GetVBVariableInfo -target:exe -out:GetVBVariableInfo GetVBVariableInfo.vb
Assembly 'GetVBVariableInfo, Version=0.0, Culture=neutral, PublicKeyToken=null' saved successfully to 'GetVBVariableInfo'.
Compilation successful
Compilation took 00:00:01.0309060
Variable Type: MinValue: MaxValue:
Char: ￿
Boolean: False True
Byte: 0 255
UShort: 0 65535
UInt16: 0 65535
UInteger: 0 4294967295
UInt32: 0 4294967295
ULong: 0 18446744073709551615
UInt64: 0 18446744073709551615
SByte: -128 127
Short: -32768 32767
Int16: -32768 32767
Integer: -2147483648 2147483647
Int32: -2147483648 2147483647
Long: -9223372036854775808 9223372036854775807
Int64: -9223372036854775808 9223372036854775807
Decimal: -79228162514264337593543950335 79228162514264337593543950335
Single: -340282346638529000000000000000000000000 340282346638529000000000000000000000000
Double: -1,79769313486232E+308 1,79769313486232E+308
DoubleMinValueFull: -179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
DoubleMaxValueFull: 179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> GetVBVariableInfo-compile.bat && GetVBVariableInfo.exe
Variable Type: MinValue: MaxValue:
Char: ?
Boolean: False True
Byte: 0 255
UShort: 0 65535
UInt16: 0 65535
UInteger: 0 4294967295
UInt32: 0 4294967295
ULong: 0 18446744073709551615
UInt64: 0 18446744073709551615
SByte: -128 127
Short: -32768 32767
Int16: -32768 32767
Integer: -2147483648 2147483647
Int32: -2147483648 2147483647
Long: -9223372036854775808 9223372036854775807
Int64: -9223372036854775808 9223372036854775807
Decimal: -79228162514264337593543950335 79228162514264337593543950335
Single: -340282346638529000000000000000000000000 340282346638529000000000000000000000000
Double: -1,79769313486232E+308 1,79769313486232E+308
DoubleMinValueFull: -179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
DoubleMaxValueFull: 179769313486232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment