The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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?
JJJisha Joy Syncfusion Team 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
MAMark AtkinsonFebruary 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.
MAMark AtkinsonFebruary 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; }
JJJisha Joy Syncfusion Team February 15, 2008 05:14 AM UTC
Hi Mark,
Thank you for your update. Glad to hear that the issue has been resolved.