DateTime formatting issue.

  • Thread starter Thread starter KenA
  • Start date Start date
K

KenA

Hi,

When I use this in a WebForm it works perfectly :

DateTime dt = DateTime.Now;
IFormatProvider format = new System.Globalization.CultureInfo("pt-BR",
true);
dt = DateTime.Parse( dt.ToString(), format,
System.Globalization.DateTimeStyles.NoCurrentDateDefault );

But when I use it in WindowsForms I receive the following exception
msg:

System.FormatException
Additional Information : string was not recognized

Any ideas why?
 
The language on the computer you're running this on is not set to "pt-BR".
Your code doesn't make sense. What are you trying to do?

/claes
 
Back
Top