VB6 Tutorial 39: Data Inspection Functions

Posted On 2018-04-23 by VB6Boy
Tags: VB6 Tutorials 
Views: 47

Looking for the more of the VB6 Tutorial? Here is the tutorial index.

You'll learn about some data inspection functions in this lesson. These functions will inspect the expression. More precisely, these functions will provide you the information related to your expression. You'll get these functions in the Object Browser inside the "Information" module.

In this lesson, we'll be learning about the following functions:

  • IsNumeric
  • IsArray
  • IsDate
  • IsEmpty
  • IsObject
  • TypeName
  • IsError
  • IsMissing
  • IsNull


The IsNumeric function returns Boolean value, returns True if an expression can be evaluated to a number.

This function is useful when you want your users to enter only the numeric values in the required field.


Private Sub cmdCheck_Click()
    If IsNumeric(txtField.Text) = True Then
        MsgBox "Value accepted"
        MsgBox "Please enter a numeric value"
    End If
End Sub


The IsArray function returns a Boolean value, returns True if the variable is an array. When you want to check whether a particular variable is an array, the IsArray function is useful.


Dim team(20) As Integer
If IsArray(team) = True Then
    MsgBox "This is an array"
    MsgBox "This is NOT an array"
End If


The IsDate function returns a boolean value, returns True if an expression is a date.


Dim dt As Date

dt = 20 / 20 / 2013

If IsDate(dt) = True Then
    MsgBox "This is a date"
    MsgBox "This is NOT a date"
End If


The IsEmpty function returns True if a variable has not been initialized.


Take a variant variable score.

If IsEmpty(score) = True Then
        MsgBox "Not initialized"
        MsgBox "Initialized"
End If


The IsObject function returns True if the variable is of Object type.


Dim frm As Form
If IsObject(frm) = True Then
    MsgBox "Object variable"
    MsgBox "This is NOT an object variable"
End If


Returns the datatype of the variable.


Dim n As Integer
n = 34
Dim str As String
str = TypeName(n)
MsgBox str


Returns True if an expression is an error value.


Returns True if an optional argument has not been passed.


Returns True if an expression doesn't contain any valid data.

Related topics

About the Author

has posted a total of 78 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links