'Start a new project and add 3 command buttons and 1 textbox 'do not rename them and place them anywhere 'Copy this entire text file and paste into (General)(declarations) 'Press F5 to run ' ' This sample shows the conversions of Variant DataTypes ' also show multiple "Onb Error" error handling ' #If Win16 Then Private Declare Sub ShellAbout Lib "shell.dll" _ ( _ ByVal hWndOwner As Integer, _ ByVal lpszAppName As String, _ ByVal lpszMoreInfo As String, _ ByVal hIcon As Integer _ ) #ElseIf Win32 Then Private Declare Function ShellAbout Lib "shell32.dll" _ Alias "ShellAboutA" _ ( _ ByVal hwnd As Long, _ ByVal szApp As String, _ ByVal szOtherStuff As String, _ ByVal hIcon As Long _ ) As Long #End If Dim mvTester As Variant Dim mdDateTest As Date Dim miIntTest As Integer Dim mlLongTest As Long Dim msSingleTest As Single Dim mdDoubleTest As Double Dim mcCurrTest As Currency Dim msStringTest As String Dim mbBoolTest As Boolean Dim mbyteByteTest As Byte Private Sub Command1_Click() Cls Print Print mvTester = Text1.Text Dim sbVarShow As Boolean sbVarShow = True On Error GoTo NotDate mdDateTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a date = " & mdDateTest sbVarShow = True On Error GoTo NotInt miIntTest = mvTester If sbVarShow = True Then Print Text1.Text & " as an integer = " & miIntTest sbVarShow = True On Error GoTo NotLong mlLongTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a Long = " & mlLongTest sbVarShow = True On Error GoTo NotSingle msSingleTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a single = " & msSingleTest sbVarShow = True On Error GoTo NotDouble mdDoubleTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a double = " & mdDoubleTest sbVarShow = True On Error GoTo NotCurr mcCurrTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a Currency = " & mcCurrTest sbVarShow = True On Error GoTo NotString msStringTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a string = " & msStringTest sbVarShow = True On Error GoTo NotBool mbBoolTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a Boolean = " & mbBoolTest sbVarShow = True On Error GoTo NotByte mbyteByteTest = mvTester If sbVarShow = True Then Print Text1.Text & " as a byte = " & mbyteByteTest Exit Sub NotDate: Print Text1.Text & " is not a Date" sbVarShow = False Resume Next NotInt: Print Text1.Text & " is not an Integer" sbVarShow = False Resume Next NotLong: Print Text1.Text & " is not a Long" sbVarShow = False Resume Next NotSingle: Print Text1.Text & " is not a Single" sbVarShow = False Resume Next NotDouble: Print Text1.Text & " is not a Double" sbVarShow = False Resume Next NotCurr: Print Text1.Text & " is not a Currency" sbVarShow = False Resume Next NotString: Print Text1.Text & " is not a String" sbVarShow = False Resume Next NotObj: Print Text1.Text & " is not an Object" sbVarShow = False Resume Next NotBool: Print Text1.Text & " is not Boolean" sbVarShow = False Resume Next NotByte: Print Text1.Text & " is not a Byte" sbVarShow = False Resume Next End Sub Private Sub Command2_Click() Call ShellAbout _ ( _ Me.hwnd, _ "Variant Data type Sample", _ "MaLLoDoG's Variant Data type" & vbLf & _ "program demonstration", _ Me.Icon _ ) End Sub Private Sub Command3_Click() Unload Me End End Sub Private Sub Form_Load() 'Center the form on the screen Me.Top = Screen.Height / 2 - Height / 2 Me.Left = Screen.Width / 2 - Width / 2 Text1.Height = 250 Text1.Width = 3000 Text1.Left = 10 Text1.Top = Me.Height - Text1.Height * 4 Text1.Text = "Enter something here" Command1.Height = 500 Command1.Width = 1400 Command1.Top = Me.Height - Command1.Height * 4 Command1.Left = 1000 Command1.Caption = "what is it?" Command2.Height = 500 Command2.Width = 1400 Command2.Top = Me.Height - Command2.Height * 4 Command2.Left = 3000 Command2.Caption = "About" Command3.Height = 500 Command3.Width = 1400 Command3.Top = Me.Height - Command3.Height * 4 Command3.Left = 5000 Command3.Caption = "Exit" End Sub