Custom controls in VS 2005 inheritance not working :(

G

Genifer

Hi,



I have a custom control created in VS 2005 for CF 2.0. The control
(DataGridEx) inherits from the DataGrid class. When I look at the properties
list for my custom control at design time, I don't see the TableStyles
collection property. So it looks like the custom control isn't inheriting
from the datagrid control. :(



However I do see the TableStyles property in design time when I look at my
2003 version of this custom control.



Anyone have any ideas?



Thanks



Gen.
 
G

Genifer

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that inherits from the DataGrid control the control will not appear correctly in the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for custom controls in the designer?



Thanks
 
I

Ilya Tumanov [MS]

Probably because Microsoft.WindowsCE.Forms is not available on desktop
framework designers are working against.
You might be able to workaround by adding Microsoft.WindowsCE.Forms.dll
metadata file to desktop's GAC.
To do that locate Microsoft.WindowsCE.Forms.dll and execute "gacutil /I
Microsoft.WindowsCE.Forms.dll".

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

FYI

Well i found the problem...

If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly in
the forms designer...

private Microsoft.WindowsCE.Forms.InputPanel sip;

Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?

Thanks
 
D

Daniel Moth

It could be that you need to add to your xmta file the DesktopCompatible attribute. Right click on your file with the control and "View Class Diagram". Select the control in the class diagram and in the properties window bring up the Custom Attributes editor and paste in DesktopCompatbile(true)

For more see this article:
http://symbian.sys-con.com/read/113332_3.htm

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that inherits from the DataGrid control the control will not appear correctly in the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for custom controls in the designer?



Thanks
 
T

Tim Wilson

This is just a guess at this point, since I'd have to fire up my VPC (which
can be quite slow), but have you tried marking the control with the
"DesktopCompatible" attribute? [DesktopCompatible(true)]

--
Tim Wilson
..Net Compact Framework MVP

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly in
the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?



Thanks
 
G

Genifer

I do have [DesktopCompatible(true)]

Now the designer form is lost and i get the error "object reference not set
to an instance of an object" for line 53 of the Form1.Designer.cs code for
the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

As you can see I did set the image property to an actual image at design
time.

Any idea why the form designer dies on this line? Should I have an attribute
for properties of type image?

Thanks for the help guys!

Gen

Tim Wilson said:
This is just a guess at this point, since I'd have to fire up my VPC
(which
can be quite slow), but have you tried marking the control with the
"DesktopCompatible" attribute? [DesktopCompatible(true)]

--
Tim Wilson
.Net Compact Framework MVP

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly
in
the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?



Thanks







Genifer said:
Hi,



I have a custom control created in VS 2005 for CF 2.0. The control
(DataGridEx) inherits from the DataGrid class. When I look at the properties
list for my custom control at design time, I don't see the TableStyles
collection property. So it looks like the custom control isn't inheriting
from the datagrid control. :(



However I do see the TableStyles property in design time when I look at
my
2003 version of this custom control.



Anyone have any ideas?



Thanks



Gen.
 
T

Tim Wilson

What happens when you comment, or remove, that line in the Form1.Designer.cs
file? I'm assuming that the form will display now?

--
Tim Wilson
..Net Compact Framework MVP

Genifer said:
I do have [DesktopCompatible(true)]

Now the designer form is lost and i get the error "object reference not set
to an instance of an object" for line 53 of the Form1.Designer.cs code for
the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

As you can see I did set the image property to an actual image at design
time.

Any idea why the form designer dies on this line? Should I have an attribute
for properties of type image?

Thanks for the help guys!

Gen

Tim Wilson said:
This is just a guess at this point, since I'd have to fire up my VPC
(which
can be quite slow), but have you tried marking the control with the
"DesktopCompatible" attribute? [DesktopCompatible(true)]

--
Tim Wilson
.Net Compact Framework MVP

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly
in
the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?



Thanks







Genifer said:
Hi,



I have a custom control created in VS 2005 for CF 2.0. The control
(DataGridEx) inherits from the DataGrid class. When I look at the properties
list for my custom control at design time, I don't see the TableStyles
collection property. So it looks like the custom control isn't inheriting
from the datagrid control. :(



However I do see the TableStyles property in design time when I look at
my
2003 version of this custom control.



Anyone have any ideas?



Thanks



Gen.
 
G

Genifer

Hey Tim,

After I added DesktopCompatible(true) I was able to remove the remark for the line below...

private Microsoft.WindowsCE.Forms.InputPanel sip;

But now I get the error "Object reference not set to an instance of an object" for the line below...

this.dataGridEx1.LockImage = ((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

With the error above the form will not display and if I remark it out VS will just replace it with the line below set to null, so I can't get the form to show.

this.dataGridEx1.LockImage = null;

I use a property of type Image to set the Image at design time. Do I need a special designer attribute for properties of type Image?

Thanks ;)





Tim Wilson said:
What happens when you comment, or remove, that line in the Form1.Designer.cs
file? I'm assuming that the form will display now?

--
Tim Wilson
.Net Compact Framework MVP

Genifer said:
I do have [DesktopCompatible(true)]

Now the designer form is lost and i get the error "object reference not set
to an instance of an object" for line 53 of the Form1.Designer.cs code for
the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

As you can see I did set the image property to an actual image at design
time.

Any idea why the form designer dies on this line? Should I have an attribute
for properties of type image?

Thanks for the help guys!

Gen

Tim Wilson said:
This is just a guess at this point, since I'd have to fire up my VPC
(which
can be quite slow), but have you tried marking the control with the
"DesktopCompatible" attribute? [DesktopCompatible(true)]

--
Tim Wilson
.Net Compact Framework MVP

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly
in
the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?



Thanks







Hi,



I have a custom control created in VS 2005 for CF 2.0. The control
(DataGridEx) inherits from the DataGrid class. When I look at the
properties
list for my custom control at design time, I don't see the TableStyles
collection property. So it looks like the custom control isn't inheriting
from the datagrid control. :(



However I do see the TableStyles property in design time when I look at
my
2003 version of this custom control.



Anyone have any ideas?



Thanks



Gen.
 
T

Tim Wilson

What if you set the "DefaultValue" attribute of your "LockImage" property to
"null"? Then, assuming no image is specified, you should not see code
serialized to the InitializeComponent method of the form for the "LockImage"
property since the default is "null" and the "LockImage" property, by
default, is set to "null". You should not need anything special to allow the
designer to interoperate with your "LockImage" property if it's of type
"System.Drawing.Image".

--
Tim Wilson
..Net Compact Framework MVP

Hey Tim,

After I added DesktopCompatible(true) I was able to remove the remark for
the line below...

private Microsoft.WindowsCE.Forms.InputPanel sip;

But now I get the error "Object reference not set to an instance of an
object" for the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

With the error above the form will not display and if I remark it out VS
will just replace it with the line below set to null, so I can't get the
form to show.

this.dataGridEx1.LockImage = null;

I use a property of type Image to set the Image at design time. Do I need a
special designer attribute for properties of type Image?

Thanks ;)





Tim Wilson said:
What happens when you comment, or remove, that line in the Form1.Designer.cs
file? I'm assuming that the form will display now?

--
Tim Wilson
.Net Compact Framework MVP

Genifer said:
I do have [DesktopCompatible(true)]

Now the designer form is lost and i get the error "object reference not set
to an instance of an object" for line 53 of the Form1.Designer.cs code for
the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

As you can see I did set the image property to an actual image at design
time.

Any idea why the form designer dies on this line? Should I have an attribute
for properties of type image?

Thanks for the help guys!

Gen

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
This is just a guess at this point, since I'd have to fire up my VPC
(which
can be quite slow), but have you tried marking the control with the
"DesktopCompatible" attribute? [DesktopCompatible(true)]

--
Tim Wilson
.Net Compact Framework MVP

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly
in
the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?



Thanks







Hi,



I have a custom control created in VS 2005 for CF 2.0. The control
(DataGridEx) inherits from the DataGrid class. When I look at the
properties
list for my custom control at design time, I don't see the TableStyles
collection property. So it looks like the custom control isn't inheriting
from the datagrid control. :(



However I do see the TableStyles property in design time when I look at
my
2003 version of this custom control.



Anyone have any ideas?



Thanks



Gen.
 
G

Genifer

Tried that but didn't fix it. I think once I lose my form somthing gets lost
with the resources.

Anyway I think this is a side effect to the real problem below.

If I have "DesktopCompatible(true)" I get a "null ref exception" in the
constructor for the line below. Im using reflection to access the rendering
object of the base datagrid control. This code works in VS 2003 with no
errors.

public DataGridEx()
{
m_r = typeof(DataGrid).GetField("m_renderer",
BindingFlags.NonPublic | BindingFlags.GetField |
BindingFlags.Instance).GetValue(this);

Is there a precomplier directive that will allow the designer to ignore code
at design time but will run the code at run-time that I don't have to change
in project properties each time I switch from forms design to running the
app? I have used #if !NETCFDESIGNTIME in VS 2003 but It didn't seem to work
in 2005.

Thanks



Tim Wilson said:
What if you set the "DefaultValue" attribute of your "LockImage" property
to
"null"? Then, assuming no image is specified, you should not see code
serialized to the InitializeComponent method of the form for the
"LockImage"
property since the default is "null" and the "LockImage" property, by
default, is set to "null". You should not need anything special to allow
the
designer to interoperate with your "LockImage" property if it's of type
"System.Drawing.Image".

--
Tim Wilson
.Net Compact Framework MVP

Hey Tim,

After I added DesktopCompatible(true) I was able to remove the remark for
the line below...

private Microsoft.WindowsCE.Forms.InputPanel sip;

But now I get the error "Object reference not set to an instance of an
object" for the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

With the error above the form will not display and if I remark it out VS
will just replace it with the line below set to null, so I can't get the
form to show.

this.dataGridEx1.LockImage = null;

I use a property of type Image to set the Image at design time. Do I need
a
special designer attribute for properties of type Image?

Thanks ;)





Tim Wilson said:
What happens when you comment, or remove, that line in the Form1.Designer.cs
file? I'm assuming that the form will display now?

--
Tim Wilson
.Net Compact Framework MVP

Genifer said:
I do have [DesktopCompatible(true)]

Now the designer form is lost and i get the error "object reference not set
to an instance of an object" for line 53 of the Form1.Designer.cs code for
the line below...

this.dataGridEx1.LockImage =
((System.Drawing.Image)(resources.GetObject("dataGridEx1.LockImage")));

As you can see I did set the image property to an actual image at design
time.

Any idea why the form designer dies on this line? Should I have an attribute
for properties of type image?

Thanks for the help guys!

Gen

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
This is just a guess at this point, since I'd have to fire up my VPC
(which
can be quite slow), but have you tried marking the control with the
"DesktopCompatible" attribute? [DesktopCompatible(true)]

--
Tim Wilson
.Net Compact Framework MVP

FYI



Well i found the problem...



If I have the following line in my custom control (non user type) that
inherits from the DataGrid control the control will not appear correctly
in
the forms designer...



private Microsoft.WindowsCE.Forms.InputPanel sip;



Why does having a declaration to the InputPanel cause such a problem for
custom controls in the designer?



Thanks







Hi,



I have a custom control created in VS 2005 for CF 2.0. The control
(DataGridEx) inherits from the DataGrid class. When I look at the
properties
list for my custom control at design time, I don't see the
TableStyles
collection property. So it looks like the custom control isn't inheriting
from the datagrid control. :(



However I do see the TableStyles property in design time when I look at
my
2003 version of this custom control.



Anyone have any ideas?



Thanks



Gen.
 
T

Tim Wilson

Can you package up your entire solution, app code, project files, and
control code, and post it back here as a zip file? If you can't attach files
then send it to the email address below and I'll look at it.

dllhell (AT) hotmail (DOT) com
 

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