Forum  Commercial Foru...  Commercial Foru...  DateTimePicker exception thrown when user selects 12/9999
Previous Previous
 
Next Next
New Post 1/26/2010 9:22 AM
  globalservices
150 posts
5th Level Poster


DateTimePicker exception thrown when user selects 12/9999 
Modified By globalservices  on 1/26/2010 1:23:23 PM)

Using a DatetimePicker the user gets an unhandled exception when selecting any day in the month of December, 9999.  I know this probably never happens, but in our system we use DateTime.MaxValue (12/31/9999 11:59:59) in several areas to indicate that the item (rule, report, etc.) has no expiration date.  So when loading the screen the value 12/31/9999 is displayed in the date time picker, but once the user clicks the drop down of the control they get an exception:

The added or subtracted value results in an un-representable DateTime.
Parameter name: months

[ArgumentOutOfRangeException: The added or subtracted value results in an un-representable DateTime.
Parameter name: months]
   System.DateTime.AddMonths(Int32 months) +4617044
   Gizmox.WebGUI.Forms.MonthCalendar.Render(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +302
   Gizmox.WebGUI.Forms.Control.RenderControl(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +278
   Gizmox.WebGUI.Forms.Form.Render(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +112
   Gizmox.WebGUI.Forms.Form.RenderControl(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +365
   Gizmox.WebGUI.Forms.Form.RenderForms(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +70
   Gizmox.WebGUI.Forms.Form.RenderControl(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +365
   Gizmox.WebGUI.Forms.Form.Gizmox.WebGUI.Common.Interfaces.IForm.RenderForm(IContext objContext, IResponseWriter objWriter, Int64 lngRequestID) +41
   Gizmox.WebGUI.Server.Content.ProcessRequest(HttpContext objHttpContext) +2705
 

I will send a sample application to your support email address, thanks,

Andrew

 
New Post 1/26/2010 3:05 PM
  palli
14415 posts
1st Level Poster




Re: DateTimePicker exception thrown when user selects 12/9999 
Modified By palli  on 1/26/2010 7:05:48 PM)

Hi Andrew,

This is in accordance with WinForms and also in accordance with the Visual WebGui designer. The highest possible value to enter is 31. december 9998.

I suggest you pick the year 9998 for the no expiration date value.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  DateTimePicker exception thrown when user selects 12/9999
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS