cancel
Showing results for 
Search instead for 
Did you mean: 

Testing for Null Object

Highlighted
Contributor

Testing for Null Object

I am using a DevExpress TreeList. I have an object that I want to check how many children it has. It's fine if it has children, but if it doesn't, it shows up as (Null Object). If it doesn't have any children, it doesn't have a wRowCount of 0, the wRowCount simply doesn't exist. If I could verify that this is a Null Object, that would be fine, but I can't figure out how to do this.



I tried IsNull(XYZ.WinFormsObject("dataFieldTree1").WinFormsObject("dataFieldTreeList").wChildView(0)), but that just reports false.



I want to check if this is a Null Object before I check the wRowCount property, because otherwise it's going to blow up if it is a Null Object, the wRowCount property won't exist.

 
3 REPLIES 3
Highlighted
Contributor

RE: Testing for Null Object

Which scripting language are you using?
Highlighted
Contributor

RE: Testing for Null Object

I'm usinig VBScript
Highlighted
Staff

RE: Testing for Null Object

Hi,



For objects, you need to check whether Nothing is returned.

Set obj = ...

If Not obj Is Nothing Then 'the object is not empty

------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors