ASP.NET VarType() ตรวจสอบชนิดของค่าตัวแปร เช่น ตัวเลข ข้อความ หรือ อาร์เรย์
CONSTANT
Constant
Value
Description
vbEmpty
0
Empty (uninitialized)
vbNull
1
Null (no valid data)
vbInteger
2
Integer
vbLong
3
Long integer
vbSingle
4
Single-precision floating-point number
vbDouble
5
Double-precision floating-point number
vbCurrency
6
Currency
vbDate
7
Date
vbString
8
String
vbObject
9
Automation object
vbError
10
Error
vbBoolean
11
Boolean
vbVariant
12
Variant (used only with arrays of Variants)
vbDataObject
13
A data-access object
vbByte
17
Byte
vbArray
8192
Array
Syntax
VarType(varname)
Sample
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim strVar1(3)
Dim strVar2,strVar3
strVar1(0) = 1
strVar1(1) = 2
strVar1(2) = 3
strVar1(3) = 4
strVar2 = "Weerachai Nukitram"
strVar3 = 123456
Me.lblText1.Text = VarType(strVar1)
Me.lblText2.Text = VarType(strVar2)
Me.lblText3.Text = VarType(strVar3)
End Sub