Troubleshooting Exceptions: System.FormatException
.NET Framework 3.0
A FormatException exception is thrown when the format of an argument does not meet the parameter specifications of the invoked members. For example, if a method specifies a string parameter consisting of two digits with an embedded period, passing a string argument containing only two digits to that method would cause a FormatException exception to be thrown.
- Make sure your method arguments are in the right format.
-
The format of your method arguments must meet the parameter specifications of the invoked members.
- When converting a string to DateTime, parse the string to take the date before putting each variable in the DateTime object.
-
For example, DateTime.Minute = 30. For more information, see DateTime.