How to know if a object,like a Datatable type of varible, whether or not was set to an instance?

Hi guys.
How to know if a object,like a Datatable type of varible, whether or not was set to an instance?
Datatable.Rows.Count maybe equals 0.but I can’t use this,if the datatable not created.
Best Regards!

Hi,

We can check whether the datatable has instance as the following.

dt isnot Nothing

If you also want to check whether the datatable has any row, the following condition will work.

dt isnot Nothing AndAlso dt.Rows.Count>0

Regards,

1 Like

@donghai
to check if the variable is null give a try on
isNothing(yourVariable)

1 Like

Hi @Yoichi @ppr

It’s amazing,I was test these two before,but It was not worked as I wanted.
But this time,It’s worked.
Thanks Again. :joy:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.