[Gambas-user] Can one test for a null object?
Robert Rowe
robert.c.rowe at ...626...
Mon Mar 17 03:01:08 CET 2008
Have you tried:
IF Null?(frmClinical.currentProject.past_history) THEN
x = frmClinical.currentProject.past_history.count
ELSE
x = 0
ENDIF
You could also use TRY
x = 0
TRY x = frmClinical.currentProject.past_history.count
IF ERROR then
'Do whatever you want if an error occurs
ENDIF
Robert Rowe
richard terry wrote:
> When I load a patients past history into my program I want to be able to get
> the total count to do something, but if there is nothing in the
> currentPatient.past_history collection, this line bombs:
>
> x = frmClinical.currentPatient.past_history.count
>
> and says 'null object'
>
> I has various attempts to test this first, with no luck.
>
> Any help appreciated.
>
> Richard T
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
More information about the User
mailing list