formatexception

C# WPF app crashes with System.FormatException - Corrupt .resources file

I've inherited a C# .net WPF application from a now ex-employee and am having some difficulties running the application. It all builds fine without a single error or warning, but before the GUI appears I get an error: An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: Corrupt...

Proper DateTime Format for a Web Service

I have a webservice with a method which is called via a xmlhttprequest object in my javascript. The method accepts a datetime parameter which is subsequently converted to a string and run against the database to perform a calculation. I get the value from m_txtDateAdd and send off the xmlHttprequest <asp:textbox id=m_txtDateAdd tabInde...

Fixing FormatException in datagrid view with a checkbox column

I've got a datagrid control bound to BindingList of objects. One of the Properties of the object class is boolean. I have customized that column in the datagridview to be a checkbox type. Things work correctly when the datagridview loads for the rows that have values brought in from the binding list. However, when the "new entry" lin...

Why does FormatException not inherit from ArgumentException?

Is there a known reason why FormatException does not inherit from ArgumentException? An invalid format would seem to be a very specific case of an argument being invalid, similar to ArgumentOutOfRangeException. The MSDN article for the class states: FormatException is thrown when the format of an argument in a method invocation doe...

Handling FormatExceptions using XmlSerializer.Deserialize

I have a third party web service that returns this xml <book> <release_date>0000-00-00</release_date> </book> I am trying to deserialize it into this class public class Book { [XmlElement("release_date")] public DateTime ReleaseDate { get; set; } } But because 0000-00-00 isn't a valid DateTime, I get a FormatException. Wh...

Strange FormatException after upgrading in VS 2010

I get this FormatException after i upgraded to VS 2010. Not anything really special. Code: private void ManageDateEditControls() { apoDateEdit.DateTime = DateTime.Parse(string.Format("01/{0}/{1}", DateTime.Now.Month-1, DateTime.Now.Year)); eosDateEdit.DateTime = DateTime.Parse(string.Format("{0}/{1}/{2}", GetLastDayOfMonth(DateT...

FormatException in DetailsView, which uses dynamically inserted value for Item of DrodDownList

Hello! I use DetailsView with ObjectDataSource to insert entry in database. DropDownList ddl_kinds is bound to some field. I complete dropdownlist dynamically. Last listItem of dropdownlist has TextField "Null value" and ValueField "0". But when I choose this item in DetailsView and try to send form, FormatException is thrown. There is...

WPF FontFamily Format question

Hi, I'm trying to set the selected value of my Font Family combobox, which has been populated with the following XAML: <ComboBox ItemsSource="{x:Static Fonts.SystemFontFamilies}" Name="cboFont"> <ComboBox.ItemsPanel> <ItemsPanelTemplate> <VirtualizingStackPanel MinWidth="256" /> </ItemsPanelTemplate> ...

Weird DateTime.Parse exception in 3.5?

This line of code works on my computer (64-bit Win7). I tested on XP 32bits in a VM. It works fine. static bool HasExpire { get { return DateTime.Now >= DateTime.Parse("10/20/2010"); } } However on a client machine it throws this exception: An unhandled exception was generated during the execution of the current web request. Inf...