Binding problems with DataGridView in User Control

1

123qwe

I have a Windows Forms-based solution in Visual Studio 2005, containing two
projects one a Windows Control Library and a Windows Application. the Control
Library has a Custom Control which aggregates a DataGridVew control. This
custom control is consumed in the Form (part of Windows application project).

When I try binding the DataGridView with a collection of Custom Objects at
runtime, the code executes properly without any exceptions but its not
showing up the data. where as when I write similar code using the
DataGridView dropped directly on a Form its works perfectly fine.

Note: the Custom class I am using to bind is a WCF Data contract class
(since it work fine with the grid on Win form, ideally it shouldnt be a
problem with the Grid on the User control).

please help.
 
Joined
Jan 15, 2009
Messages
1
Reaction score
0
error in adding user control containing datagridview

I am working with a winform application. I have created usercontrol with datagridview.
when i m trying to add this control to a winform its giving NullReferenceException. If I write the code
to add the usercontrol in form.designer.cs. it will work fine. later if i add the usercontrol to the form directly
its not adding. the exact error message is given below:
Failed to create component 'usercontrol'
'System.NullReferenceException: Object Reference not set to an instance of an object.
at usercontrol_load()
if i modify the form then the added usercontrol part will be deleted automatically in designer.cs file of a winform.

Please give me a solution as soon as possible
Any help appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top