Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > 'Error : Object reference not set an instance of an object' in DataGridView in Window
 

'Error : Object reference not set an instance of an object' in DataGridView in Window

Hi , I am usingDataGridView of window control and to load data in DtaGridViewusing thread in Page Load.
Also usingthread.sleep(50000) time to loaddata. It isopened in first time but after some time It return 'Object reference not set an instance of an object' ' and some x big image in DataGridView.
Details error are as ,
at System.Windows.Forms.DataGridViewBand.GetHeightInfo(Int32 rowIndex, Int32& height, Int32& minimumHeight)
at System.Windows.Forms.DataGridView.PaintRows(Graphics g, Rectangle boundingRect, Rectangle clipRect, Boolean singleHorizontalBorderAdded)
at System.Windows.Forms.DataGridView.PaintGrid(Graphics g, Rectangle gridBounds, Rectangle clipRect, Boolean singleVerticalBorderAdded, Boolean singleHorizontalBorderAdded)
at System.Windows.Forms.DataGridView.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.DataGridView.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)

Can any one please help me to resolved this issue or is this error with DataGridView Control ??

Thanks & regards ,
Nawnit
Nawnit Kumar  Tuesday, September 08, 2009 1:52 PM
This occurs when you are tring to read a value from the datagrid cell which is not present..

you may be trying to read the data from the datagrid before the thread loads the data..
Bharath kumar Y.S  Wednesday, September 09, 2009 5:09 AM
Hi Nawnit Kumar,

Could you please let us know if bharathkumar_ys's reply helps or not? If not, please provide the code snippet about data loading or more information.

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, September 10, 2009 8:38 AM

Hi,

We are changing the issue type to “General Discussion�because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question�by opening the Options list at the top of the post window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Tuesday, September 15, 2009 2:38 AM

You can use google to search for other answers

Custom Search

More Threads

• WebService tickets
• Cannot access a disposed object named "MainForm"
• Help
• Server Setup Package Taskvision 2.0
• Problem with InfoPath2007IOleCommands Sample
• Looking for example for avoidance code
• Terrarium server !!!
• how does issue vision "redraw" screen when spitter is dragged ?
• TaskListControl
• No docs no articles!