angireddy
asked on
How to check for the datagrid datasource to be null
I have a datagrid which populates at runtime and then I use
dataView = ctype(datagrid.datasource, DataView)
if dataview.count = 0 then
.....
at "if...." I am getting null reference. How to check for the datasource is present or not.
Reddy
dataView = ctype(datagrid.datasource,
if dataview.count = 0 then
.....
at "if...." I am getting null reference. How to check for the datasource is present or not.
Reddy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I wouldn't use a try catch on this. That could be a performance hit. The best way is to check that the object is not "Nothing"
KGREG
KGREG
Save the Try Blocks for "exceptional" cases. If you can check for the condition very easily, do it - if not - then it should be caught.. like a server going down during a transaction, or a device failing, etc.
KGREG
KGREG
ASKER
thankyou KREG, that was valuable information
reddy
reddy
' The datasource is not null
ELSE
' The datasource is null
END IF
KGREG