Discussion:
DataGrid IsupportInitialize Compact Framework Problem
(too old to reply)
Jayesh Modha
2008-06-10 22:11:12 UTC
Permalink
Hi,

I am using .NET CF 3.5 and Windows CE.
I have inherited DataGrid and made my custom DataGrid. I just have few
function on my custom datagrid.
After adding my custom DataGrid to my form, the designer add following
lines to my InitializeComponent.

((System.ComponentModel.ISupportInitialize)(this.myGrid)).BeginInit();
.
.
.
.
.
((System.ComponentModel.ISupportInitialize)(this.myGrid)).EndInit();

.NET CF DataGrid does not support ISupportInitialize but still
desinger is adding that and runtime I get Invalid Cast Exception as it
can not convert DataGrid to ISupportInitialize.

If I use just CF standard DataGrid, it does not add the above
statement to InitializeComponent.
CF DataGrid does not support ISupportInitialize interface and full
framework DataGrid supports ISupportInitialize interface.

I am wondering why this happens with inheriting DataGrid control and
not with CF DataGrid.

Is this a Designer bug?

Please help.

Thanks,
Jayesh Modha
t***@gmail.com
2008-06-19 17:01:06 UTC
Permalink
Post by Jayesh Modha
((System.ComponentModel.ISupportInitialize)(this.myGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.myGrid)).EndInit();
.NET CF DataGrid does not support ISupportInitialize but still
desinger is adding that and runtime I get Invalid Cast Exception as it
can not convert DataGrid to ISupportInitialize.
I suffer from that as well - did you find a solution?

regards,
Ralf ter Veer
Jayesh Modha
2008-06-19 21:29:35 UTC
Permalink
Post by t***@gmail.com
Post by Jayesh Modha
((System.ComponentModel.ISupportInitialize)(this.myGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.myGrid)).EndInit();
.NET CF DataGrid does not support ISupportInitialize but still
desinger is adding that and runtime I get Invalid Cast Exception as it
can not convert DataGrid to ISupportInitialize.
I suffer from that as well - did you find a solution?
regards,
Ralf ter Veer
Hi,
I could not find any solution yet.
But until I get the correct solution, i made a workaround.
I implemented the ISupportInitialize interface with empty methods.

public class DataGridEx : DataGrid, ISupportInitialize
{
#region ISupportInitialize Members
public void BeginInit()
{

}

public void EndInit()
{

}
#endregion
}
You make this workaround until we get correct solution.

Thanks,
Jayesh Modha

Loading...