Date difficulties

View: New views
2 Messages — Rating Filter:   Alert me  

Date difficulties

by richard terry-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Something I've never come to terms with which should be simple.

I have a class containing items including a date eg as a simple example which
dosn't exist and I don't use but will serve the purpose of the request:

cOrder

part as string
date as date

In a form I may have this sort of code

Dim order as new cOrder

and on the form, some textboxes e.g
txtPart
txtDate

When I type into the box I want the contents to end up in the class:

order.part = txtPart.text
order.date = txtDate.text

The program complains about invalid date.

I.e all I want is a simple exmple of how to use a textbox to put a date in the
correct format.

Hope that's not too ambiguous.

Thanks in advance.

Richard

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user

Re: Date difficulties

by jacky-12 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Le Saturday 28 June 2008 06:37:51 richard terry, vous avez écrit :

> Something I've never come to terms with which should be simple.
>
> I have a class containing items including a date eg as a simple example
> which dosn't exist and I don't use but will serve the purpose of the
> request:
>
> cOrder
>
> part as string
> date as date
>
> In a form I may have this sort of code
>
> Dim order as new cOrder
>
> and on the form, some textboxes e.g
> txtPart
> txtDate
>
> When I type into the box I want the contents to end up in the class:
>
> order.part = txtPart.text
> order.date = txtDate.text
>
> The program complains about invalid date.
>
> I.e all I want is a simple exmple of how to use a textbox to put a date in
> the correct format.
>
> Hope that's not too ambiguous.
>
> Thanks in advance.
>
> Richard

Hello Terry

txtDate.txt = "01.01.2008" (this is a french date format : dd.mm.yyyy)
order.date = Date(Right$(txtDate.txt, 4), Mid$(txtDate.txt, 4,2),
Left$(txtDate.txt, 2))

I hope is that you want.

Jacky




-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Gambas-user mailing list
Gambas-user@...
https://lists.sourceforge.net/lists/listinfo/gambas-user
LightInTheBox - Buy quality products at wholesale price