HighTechTalks DotNet Forums  

problem converting strings to dates

Visual Studio.net (General) microsoft.public.vsnet.general


Discuss problem converting strings to dates in the Visual Studio.net (General) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
patrick_a
 
Posts: n/a

Default problem converting strings to dates - 08-22-2004 , 11:07 PM






Hi,
I've been writing a program in .net for a couple years and everything
was working fine until my hard drive had to be replaced and so I installed
visual studio on the new drive and loaded up my application. Now I get the
following error whenever I try to convert a string into a date:

An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll

Additional information: Cast from string "12/31/2022" to type 'Date' is not
valid.


This never happened before and I don't have any idea what is causing it.
Any suggestions would be much appreciated. Thanks.

Reply With Quote
  #2  
Old   
Al Gorney
 
Posts: n/a

Default RE: problem converting strings to dates - 08-24-2004 , 03:49 PM






Patrick,
this is C# code, but you can translate it to VB:
//define startDate as DateTime, also txtStartDate.Text is a string from a
web page.
startDate = Convert.ToDateTime(txtStartDate.Text);
//hope this helps, Al
"patrick_a" wrote:

Quote:
Hi,
I've been writing a program in .net for a couple years and everything
was working fine until my hard drive had to be replaced and so I installed
visual studio on the new drive and loaded up my application. Now I get the
following error whenever I try to convert a string into a date:

An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll

Additional information: Cast from string "12/31/2022" to type 'Date' is not
valid.


This never happened before and I don't have any idea what is causing it.
Any suggestions would be much appreciated. Thanks.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.