Andreas,
Than you have to know the format how that date is written and use the
overloaded command.
datetime.parseexact
http://msdn.microsoft.com/library/de...xacttopic1.asp
If you are sure that the dates are only in numbers than the last operand can
be nothing.
Be aware that this is only in the case of by instand textfiles to datetime.
In another culture will the user in the UI type the date in the style he is
used to, therefore from a textbox a CDate works perfect.
I hope this hels,
Cor
"andreas" <andreas@pandora.be> schreef in bericht
news:Vlhkg.483801$Pj5.12470332@phobos.telenet-ops.be...[color=blue]
> Yes
> I have to read a textdate from a textfile into a textbox and I would'n
> change my textfile.
> I put it again, I like to change the windows date format with a command in
> my vb.net program so that I can run my program on any PC.
>
>
> "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message
> news:eq$Pe#HkGHA.1264@TK2MSFTNGP05.phx.gbl...[color=green]
>> Andreas,
>>
>> Did you set a string to a datetime somewhere?
>>
>> By instance a command like
>> dim a as date = CDate(25/06/2006)"
>> or the same with
>> DateTime.parse
>> or with
>> DateTime.Convert
>> or with
>> CType("date",datetime)
>>
>> Cor
>>
>> "andreas" <andreas@pandora.be> schreef in bericht
>> news:uFakg.483254$t42.12494959@phobos.telenet-ops.be...[color=darkred]
>> > When the date format is changed in windows (configuration panel) i got
>> > a
>> > error on a different PC and on my own PC the dates with month =
>> > 25,13,..
>> > and so on where not listened.
>> > It depens likely on the settings mm/dd/yyyy or yyy/mm/dd.
>> > And that is my question for a solution in vb.net to detect and to
>> > change
>> > these PC settings
>> >
>> >
>> > "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> wrote in message
>> > news:OebkcGEkGHA.4044@TK2MSFTNGP03.phx.gbl...
>> >> Andreas,
>> >>
>> >> Strange, I can assure you that Ken and I exhange programs on regular
>> >> base.
>> >>
>> >> He is in the US and I in the EU. We never had any problem with[/color][/color]
> datetime.[color=green][color=darkred]
>> >>
>> >> That would be crazy because in datetime there is not in a special
>> >> culture.
>> >> It is a "long" which holds a counter of 100 nanoseconds ticks that
>> >> started
>> >> (in Net) at the Christian calendar date 01/01/01 00:00:00. In other
>> > systems
>> >> the starting time and way it is done can be different.
>> >>
>> >> But never try to convert the datetime to string formats with another
>> > reasons
>> >> than to show those.
>> >>
>> >> I hope this helps,
>> >>
>> >> Cor
>> >>
>> >>
>> >> "andreas" <andreas@pandora.be> schreef in bericht
>> >> news:Od_jg.482293$Kh.12205161@phobos.telenet-ops.be...
>> >> > When I copy a vb.net project using date formats from one PC with a
>> > windows
>> >> > date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd[/color][/color]
> then[color=green][color=darkred]
>> > I
>> >> > get errors.
>> >> > How can I change for a while in the project the date format in[/color][/color]
> vb.code[color=green][color=darkred]
>> > (
>> >> > not in Windows) and how can I find out which date format the PC[/color][/color]
> Windows[color=green][color=darkred]
>> > is
>> >> > using.
>> >> > Thanks for any response
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >[/color]
>>
>>[/color]
>
>[/color]