TypeOf <object expression> Is <TypeName>
When TypeName specifies an interface type then the TypeOf ... Is operator returns true if the object implements the interface type. When the TypeName is a class type then the operator returns true if the object is an instance of the specified class or is an instance of a class that derives from the specified class. For example:
Dim x As Button x = New Button() If TypeOf x Is Control Then ' Insert code to continue program execution.Since the type of x is Button, and Button inherits from Control, the TypeOf x Is Control expression evaluates to True.
Dim newForm As New FrmCarPayment() newForm.Show()Then try removing the word "New", moving the "New" declaration to the next line, changing the reference variable's data type to "System.Windows.Forms.Form", etc.
Dim newForm As FrmCarPayment If Not newForm Is Nothing Then ' avoid error if newForm doesn't refer to an object newForm.Show() End If