Format error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am attempting to troubleshoot the following error, so far with no success.

[InvalidCastException: Cast from string "06/17/2004" to type 'Date' is not valid.]
Microsoft.VisualBasic.CompilerServices.DateType.FromString(String Value, CultureInfo culture) +163
Microsoft.VisualBasic.CompilerServices.DateType.FromString(String Value) +53
cp_ContactManagement_v2_0.CallReport.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\cp_ContactManagement_v2_0\CallReport.aspx.vb:243
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

It is being generated from within a web application - here is the line that fails:

dtbOpenDate.xDate = Now.ToString("MM/dd/yyyy")

The error is generated only when the dll is run from my local host - many other machines including the server that hosts the site run it successfully. I have checked the date settings in my regional settings to no avail. If I change the formatting to "dd/MM/yyyy" it executes successfully, but then other failures occur. I have reinstalled my development environment environment but still have the problem.
I have not yet reinstalled IIS which is what I guess I will try next.

Thanks for any ideas you may have,
 
Hi Sheldon,

Try setting the culture and the uiCulture in the globalization section of your web.config.

For example :

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="nl-BE"
uiCulture="nl-BE"
/>

I experienced trouble with date formats, when I started using a new computer. It seemd that my frontend application was running in a different culture then my backend application. (Probably because my computer was installed with other regional settings, then I currently use.)

Setting this globalization solved my problem.

Kind regards,


Michel
 
Hi Sheldon,

Try setting the culture and the uiCulture in the globalization section of your web.config.

For example :

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="nl-BE"
uiCulture="nl-BE"
/>

I experienced trouble with date formats, when I started using a new computer. It seemd that my frontend application was running in a different culture then my backend application. (Probably because my computer was installed with other regional settings, then I currently use.)

Setting this globalization solved my problem.

Kind regards,


Michel
 
Hi Sheldon,

Try setting the culture and the uiCulture in the globalization section of your web.config.

For example :

<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="nl-BE"
uiCulture="nl-BE"
/>

I experienced trouble with date formats, when I started using a new computer. It seemd that my frontend application was running in a different culture then my backend application. (Probably because my computer was installed with other regional settings, then I currently use.)

Setting this globalization solved my problem.

Kind regards,


Michel
 
Back
Top