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.
Unfortunately, activation email could not send to your email. Please try again.

Getting "Object reference not set to an instance of an object’"

Thread ID:

Created:

Updated:

Platform:

Replies:

52492 Nov 29,2006 08:59 AM Dec 6,2006 05:41 AM Windows Forms 3
loading
Tags: GridControl
Kesavulu
Asked On November 29, 2006 08:59 AM

Hi,

I need a favour from you guys, Iam using one custom grid control, which is inherited from "Syncfusion.Windows.Forms.Grid.GridDataBoundGrid", one more custom grid column cell model control, which is inherited GridDropDownGridListControlCellModel and Windows Forms.

My form is using the custom grid control, this grid is having two columns, both are required fields to add an entry in the database. So when the gives only one field information and tries to close the form by clikcing the form closing(X). First time when user click the form closing then will receive error message "Required field is missing". Again if he press the form closing then will receive the "Object reference not set to an instance of an object".

When user tries to close the form at first time, grid row leave will execute, here iam calling e.Cancel=true and following events occurs.

- gdbgResults_CurrentCellValidating
- gdbgResults_CurrentCellAcceptedChanges
- gdbgResults_RowLeave

When user press the form closing button second time, only "gdbgResults_CurrentCellValidating" was executed and then receives the error message.

Observation:

- Grid validation becomes fail
- Grid cell moving becomes fail.

Please advice me how to proceed to avoid the error when user press the for closing button any time.

Sample85.zip

Administrator [Syncfusion]
Replied On November 30, 2006 06:18 AM

Hi kesavulu,

We were not able to reproduce the issue here. Could you please provide a sample having the issue? This will help us to analyse the issue further.

Thanks for your patience.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 30, 2006 09:22 AM

Hi Haneef,

Thanks for support.

I have given the source files in the previous mail. Could you please suggest what might be the problem to receive the error "Object reference not set to an instance".

Thanks,
Kesavulu

>Hi kesavulu,

We were not able to reproduce the issue here. Could you please provide a sample having the issue? This will help us to analyse the issue further.

Thanks for your patience.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On December 6, 2006 05:41 AM

Hi kesavulu,

You can override the form's WndProc method and dispose the form while clicking the close button. Here is a code snippet.

public const int SC_CLOSE = 0xF060;
public const int WM_SYSCOMMAND = 0x0112;

protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
{
this.Dispose();
}
base.WndProc(ref m);
}

Best Regards,
Haneef

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.

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.

;