Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Type() or empty() equivalent in VB
Message
From
16/07/2002 03:52:20
 
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00678902
Message ID:
00678987
Views:
10
This message has been marked as the solution to the initial question of the thread.
Because in VB trere are no DateTime data type, you may speak for variable of Date data type (which can contain also time) or for Variant variable. Anyway, there IsDate() function, which you can use to check if entered value (including time) is valid Date:
Dim SampleDateTimeValue As Date
Dim IsValidDateTime As Boolean

  SampleDateTimeValue = DateSerial(2002, 12, 2) + TimeSerial(11, 34, 45)
  IsValidDateTime = IsDate(SampleDateTimeValue)  'Returns True
  SampleDateTime = CDate(txtDateTime.Text)
  If Not IsDate(SampleDateTimeValue) Then
    MsgBox "Please enter valid date and time!", vbExclamation + vbOKOnly, "Error"
  EndIf

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Previous
Reply
Map
View

Click here to load this message in the networking platform