We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DateTimeCellModel exception

Thread ID:

Created:

Updated:

Platform:

Replies:

71804 Feb 13,2008 09:53 PM UTC Feb 15,2008 05:14 AM UTC WinForms 4
loading
Tags: GridControl
Mark Atkinson
Asked On February 13, 2008 09:53 PM UTC

I'm using the GridCellDateTimePickerModel/Renderer code as an alternative to the native Calendar cell in a GDBG. It has a ClickControl method that uses a Timer that adds an event handler "click" to it's Tick event. In the handler it uses ActiveXSnapshot.FakeLeftMouseClick. It's working fine for me, but one client of ours keeps getting an exception

System.NullReferenceException: Object reference not set...
at DerivedCellRenderer.click(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

...since I'm unable to repro it, I'm having a hard time figuring out what the problem might be or what might be null. the code in the Tick handler looks like this:
t.Stop();
t.Tick -= click;
Point p = dateTimePicker.PointToClient (Control.MousePosition); ActiveXSnapshot.FakeLeftMouseClick (dateTimePicker, p);
t.Dispose();
t = null;

...maybe the dateTimePicker object is null but I almost wonder if it's something to do with the ActiveXSnapshot object - like they're missing some file that's needed by that object.
Any ideas?




Jisha Joy [Syncfusion]
Replied On February 14, 2008 05:06 AM UTC

Hi Mark,

Thank you for posting query to us.

On analyzing the stack trace it seems that the issue is not because of Syncfusion Control. It is difficult to identify the problem without a working sample. Is it possible for you to upload us a minimal sample?. This will help us to analyze the issue further.

Kindly let me know if you have any questions.
Regards,
Jisha


Mark Atkinson
Replied On February 14, 2008 06:20 PM UTC

The code is the same code used in your DateTimePicker example.
Eg:
..\5.2.0.25\Windows\Grid.Windows\Samples\2.0\CustomCellTypes\DateTimePickerCells\cs

In that code, have a look at the method called "click". Something is null in there for some reason but I'm having trouble figuring out what because I, myself, can't repro it.
Either the dateTimePicker, the static ActiveXSnapshot object or maybe the Tick event.


Mark Atkinson
Replied On February 14, 2008 06:51 PM UTC

I think I found the problem. It's possible for the Timer to be null.

private void click(object sender, EventArgs e)
{
// need to check for t != null here...
t.Stop();
t.Tick -= new EventHandler(click);
Point p = this.dateTimePicker.PointToClient(Control.MousePosition);
ActiveXSnapshot.FakeLeftMouseClick(this.dateTimePicker, p);
t.Dispose();
t = null;
}


Jisha Joy [Syncfusion]
Replied On February 15, 2008 05:14 AM UTC

Hi Mark,

Thank you for your update. Glad to hear that the issue has been resolved.

Thanks,
Jisha


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;