StrataFrame Forum

Error occur when pressing delete key to clear the date value of the datetimepicker control

http://forum.strataframe.net/Topic15994.aspx

By Jeff Pagley - 4/29/2008

Hi Strataframe Team,

After I upgraded to the 1.6.5, I get the error below when I press the delete key to clear the date value of the datetimepicker control which is bound to a date field of a business object.   Although I get this error, the database is being updated properly.  Why is this error is occurring?

=======================================================================

Object reference not set to an instance of an object.
  Exception (NullReferenceException): Source="MicroFour StrataFrame UI"; Target=null; Tag=null;
    Message = "Object reference not set to an instance of an object."
  Environment: ThreadIdentity="" DateTime=["2008-04-29 16:31:15.908"] ThreadName=null WindowsIdentity="STRUSS\JPagley" ThreadId="10" DomainName="CMPR.vshost.exe" OSVersion=["Microsoft Windows NT 5.1.2600 Service Pack 2"] MachineName="1LPJPAGLEY"
    UserName="JPagley"
  Remaining 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)

By Trent L. Taylor - 4/29/2008

A lot of logic was added to the DateTimePicker in 1.6.5 to make entry available while "cleared."  It looks like you are having an API issue.  We call the Windows API to create a Caret and display it within the control...it would appear that your environment doesn't like this API call.  You can open the source and comment out this line (CreateManualCaret) to see if the error persists since this is where your stack trace stops.
By Edhy Rijo - 4/29/2008

Hi Trent,

FYI, I also got this one.  I am running Windows Vista 64.  I have not tried your solution since I really don't know how to build the dll from the source code without messing the current SF installation.

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)

By Trent L. Taylor - 4/29/2008

V64 doesn't make any difference.  I haven't had any luck with the issue that you are running into...however I did find something that I had to fix BigGrin  Give me a quick sample that reproduces the issue so I know that the properties are set the same....sometimes it is just a matter of setting up the test bed the same.  Thanks.
By Edhy Rijo - 4/30/2008

Hi Trent,

Here is a 2 for 1 quick sample project Hehe

You will find 2 forms, one for testing the datetime picker problem when you try to delete its value and the other will show you the problem with the ListView Add button which will always stay Enabled when there is not parent record.

By Trent L. Taylor - 4/30/2008

I saw something that could produce an error within certain environments.  Give this assembly a shot...I think that it will resolve your problems.  It had to do with how the API interprets bitmaps and the integer pointer.

Note: You will need to be on the 1.6.6 beta in order for this assembly to properly work.

By Edhy Rijo - 4/30/2008

Trent L. Taylor (04/30/2008)
I saw something that could produce an error within certain environments.  Give this assembly a shot...I think that it will resolve your problems.  It had to do with how the API interprets bitmaps and the integer pointer.

Note: You will need to be on the 1.6.6 beta in order for this assembly to properly work.

Hi Trent,

Yes, this assembly fixed the datetimepicker delete value problem.

Thanks.

P.S.

Where you able to test the 2nd form for the ListView issue? even thought it does not belong to this thread Smile

By Trent L. Taylor - 4/30/2008

Look here: http://forum.strataframe.net/FindPost16017.aspx

I didn't run your sample as I already knew what you were trying to accomplish, so I haven't even tested it at this point.  But you can load the assembly and see if you get what you want.

By Jeff Pagley - 4/30/2008

Hi Trent,

The new assembly also fixed the datetimepicker problem for me.

Thanks,

jjp

By Trent L. Taylor - 4/30/2008

Cool Cool