iLogic: Check if Component is there before using IsActive?

iLogic: Check if Component is there before using IsActive?

gmetcalfe
Contributor Contributor
2,164 Views
2 Replies
Message 1 of 3

iLogic: Check if Component is there before using IsActive?

gmetcalfe
Contributor
Contributor

Is it possible to either catch the error on using Component.IsActive or check for a components existence before using Component.IsActive. I have tried to catch the error when a component does not exist but have had no success. What I am trying to achive is catch/detect the error when a user has deleted a component.

 

thanks

 

Gavin

0 Likes
Accepted solutions (1)
2,165 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

The Try Catch statement sounds like what you are after.

 

Here is an example

 

Try
'try to set the component state
Component.IsActive("non existent part") = True
Catch
'catch error and assume the part does not exist
MsgBox("this part does not exist")
End Try

 

Hope this helps

 

Tom

Message 3 of 3

gmetcalfe
Contributor
Contributor

[Slaps forehead] Feel really daft now. Smiley Happy

 

For some reason I did not think you could use try catch blocks in iLogic, didn't even try it. Was messing about with the old vb style "on error" instead.

 

thanks, thats great. Smiley Happy

0 Likes