Strataframe Datetime picker control and null dates


Author
Message
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)
Group: Forum Members
Posts: 153, Visits: 462
I have spent quite a bit of time reviewing the forums and need to know what you suggest with Strataframe on this issue.

The SQL Database has datetime columns that do allow null values. I do not want them to reflect 1/1/1800 or 1/1/1900. I want them to reflect NULL if they are null.

My question is what settings need to be made in the BO Mapping as well as the datetime picker control to make this work.

I am using c#.

Replies
Ross L. Rooker, Sr.
Ross L. Rooker, Sr.
StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)StrataFrame User (245 reputation)
Group: Forum Members
Posts: 153, Visits: 462
BEN, I did what you indicated and it does work except when I use the DEL key to delete the date I get the error:

NullReferenceException
  Object reference not set to an instance of an object.

Source     : MicroFour StrataFrame UI

Stack Trace:
   at MicroFour.StrataFrame.UI.Windows.Forms.DateTimePicker.CreateManualCaret()
   at MicroFour.StrataFrame.UI.Windows.Forms.DateTimePicker.OnGotFocus(EventArgs e)
   at System.Windows.Forms.Control.WmSetFocus(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DateTimePicker.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

It appears about 3 times and then does blank out the date. Do you know why?

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You need to set a custom format to make the error go away.  This is actually not an issue but by design when wanting to have the overall NULL support since we extend the capabilities of the underlying DateTimePicker.  You can have the DateTimePicker show any date or date/time combination that you want, but you need to use a CustomFormat.  The reason for this is because we have added a lot of functionality to the DateTimePicker for the NULL support as well as caret support when in a NULL state, etc.  So if you are going to use NULLs, then you need to use a custom format.
  1. Set the Format property to Custom
  2. Set the CustomFormat property to the desired date display format.  You can get more details on this in the .NET documentation, but if you want to use a 04/01/2008 format, then it would look like this MM/dd/yyyy

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search