Hi everybody!
I was trying to test if .Net Framework is functioning on a host computer, and came around something that I can’t understand.
Below, I am creating a bogus object, and trying to check it for false. If it is false, (which in this case it will always be), I want the if….then to catch it.
Can anybody explain why example1 does not work (does not dig into if….then), while examples 2 and 3 work fine.
'Example1
On Error Resume Next
Call MySub()
Sub MySub()
Set objRandom = CreateObject("BadObject")
If objRandom = False Then
WScript.Echo "Object could not be created"
End If
End Sub
'Example2
Call MySub()
Sub MySub()
On Error Resume Next
Set objRandom = CreateObject("BadObject")
If objRandom = False Then
WScript.Echo "Object could not be created"
End If
End Sub
'Example3
On Error Resume Next
Set objRandom = CreateObject("BadObject")
If objRandom = False Then
WScript.Echo "Object could not be created"
End If
Thank You for your help.
I was trying to test if .Net Framework is functioning on a host computer, and came around something that I can’t understand.
Below, I am creating a bogus object, and trying to check it for false. If it is false, (which in this case it will always be), I want the if….then to catch it.
Can anybody explain why example1 does not work (does not dig into if….then), while examples 2 and 3 work fine.
'Example1
On Error Resume Next
Call MySub()
Sub MySub()
Set objRandom = CreateObject("BadObject")
If objRandom = False Then
WScript.Echo "Object could not be created"
End If
End Sub
'Example2
Call MySub()
Sub MySub()
On Error Resume Next
Set objRandom = CreateObject("BadObject")
If objRandom = False Then
WScript.Echo "Object could not be created"
End If
End Sub
'Example3
On Error Resume Next
Set objRandom = CreateObject("BadObject")
If objRandom = False Then
WScript.Echo "Object could not be created"
End If
Thank You for your help.