[Gambas-user] Date format

ron ronstk at ...239...
Fri Apr 9 23:31:17 CEST 2004


On Saturday 10 April 2004 01:21, Jack wrote:
> Thanks you very mutch Ron (And other s Gambers) for your answers. I
> progress a lot in Gambas ( and in English too).
> Now i have this odd thing.
> When i ask the below function with a date = "09/04/04" i have no problem.
> But when i ask the same function with a date = "31/04/04" i have a gambas
> error like
> "Type mismatch: wanted date, got String instead"
> Please, why The Catch function isn't operate ? What is wrong ?
>
>
> My function
>
> PUBLIC FUNCTION Cdate_calc(Dte AS String) AS String
> Datej.text = ""
>    FINALLY
> RETURN CDate(Dte)
>   CATCH
> message.Error("Verifiez votre saisie SVP !")
>
> END
>

You are doing the function in the finally and these are not for catch
place then return above the finally or better you do not need it here.
Second it is in the service during the return already, may that is also
not to catch anymore
Try this way:

 PUBLIC FUNCTION Cdate_calc(Dte AS String) AS String
	dim ndate as date
	ndate=cdate(Dte)
	Datej.text = ""
	RETURN ndate

 CATCH
	message.Error("Verifiez votre saisie SVP !")

 END




More information about the User mailing list