Variable set?

Variable set?

Anonymous
Not applicable
197 Views
2 Replies
Message 1 of 3

Variable set?

Anonymous
Not applicable
I want to check if a variable dim'ed as an acad entity is set or not. I
currently check a property in the entity, then check the value of err.number
for 0. Quick example below.

Private Sub cmdExsists_Click()
Dim objBlock As AcadEntity
Dim xyzPnt As Variant
Dim varTest As Variant

Me.Hide
On Error Resume Next
ThisDrawing.Utility.GetEntity objBlock, xyzPnt, "Pick an object :"
varTest = objBlock.ObjectID
If Err.Number <> 0 Then
MsgBox "No object selected"
Else
MsgBox "You have selected an object"
End If
Me.Show
End Sub

Yes, I do know that I can check Err.Number right after the GetEntity
statement, this is just a quick example.

What I want is something like this:

If IsEmpty(objBlock) then...

But this does not work. Neighter does "IsObject".

Is there any way to check whether objBlock has a value or not directly?
Anyone?

--
Rune Wold
Application Designer
Engineering Systems
[email protected]
--
0 Likes
198 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
From the Visual basic help files of VB Design http://vbdesign.hypermart.net

Hi!

To see if it set:

If Not objBlk Is Nothing Then

Or to test if its not set

If objBlk Is Nothing Then

Randall Rath
VB Design
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thank you, Randall. Worked like a charm.

--
Rune Wold
Application Designer
Engineering Systems
[email protected]
--

"Randall Rath" wrote in message
news:[email protected]...
> From the Visual basic help files of VB Design
http://vbdesign.hypermart.net
>
> Hi!
>
> To see if it set:
>
> If Not objBlk Is Nothing Then
>
> Or to test if its not set
>
> If objBlk Is Nothing Then
>
> Randall Rath
> VB Design
>
0 Likes