Binding problems with DataGridView in User Control

  • Thread starter Thread starter 123qwe
  • Start date Start date
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.
 
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!
 
Back
Top