Problem with ButtonEx and OpenNETCF 1.1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've a problem with ButtonEx and OpenNETCF 1.1. When installing OpenNETCF 1.1 all ButtonEx's in my old project using OpenNETCF 1.0 have the following error message :

The field 'MiddleCenter' could not be found on the target object. Make sure that the field is defined as an instance variable on the target object and has the correct scope.


Everything works fine when going back to OpenNETCF 1.0. This problem also occurs when adding this control in a new project using OpenNETCF 1.1. Anyone know where the problem is ?

Thanks in advance!

Knut
 
Thanks for helping!

I have the refernce to the OpenNETCF.Drawing.

Some new findings :

I think the problem have something to do with the properties window, not being able to retrieve the property value from the code.

E.g
The code is :
this.buttonEx1.ImageAlign = OpenNETCF.Drawing.ContentAlignment.MiddleLeft;

When opening the project the ImageAlign value in the properties window will be 'MiddleCenter' and the error message will appear. By setting the value to 'MiddleLeft' everything works fine until you close and reopen the project. Then the value in the properties window will be set to 'MiddleCenter' again.


A bit of a pain to change the 'ContentAlignment' of 50 button's each time i reopen the project!! :D !!

Please ask if something is unclear!
Thanks!
 
Anyone else got this problem ?


Knut said:
Thanks for helping!

I have the refernce to the OpenNETCF.Drawing.

Some new findings :

I think the problem have something to do with the properties window, not being able to retrieve the property value from the code.

E.g
The code is :
this.buttonEx1.ImageAlign = OpenNETCF.Drawing.ContentAlignment.MiddleLeft;

When opening the project the ImageAlign value in the properties window will be 'MiddleCenter' and the error message will appear. By setting the value to 'MiddleLeft' everything works fine until you close and reopen the project. Then the value in the properties window will be set to 'MiddleCenter' again.


A bit of a pain to change the 'ContentAlignment' of 50 button's each time i reopen the project!! :D !!

Please ask if something is unclear!
Thanks!
 
I've seen this problem but I can't nail down what seems to be causing it.
The TextAlign property uses the same attributes and defaults and it seems to
work correctly. The only difference is that I've never gotten an error
message, but I have seen the ImageAlign property, in the designer, get set
back to MiddleCenter even when the serialized code in InitializeComponent
says it's set to MiddleLeft. Everything worked fine when I ran the
application, it was just a cosmetic issue in the designer for me. Sorry, I
don't have a clear answer and workaround as this seems to be quite an odd
problem at this point.

--
Tim Wilson
..Net Compact Framework MVP

Knut said:
Anyone else got this problem ?
will be 'MiddleCenter' and the error message will appear. By setting the
value to 'MiddleLeft' everything works fine until you close and reopen the
project. Then the value in the properties window will be set to
'MiddleCenter' again.
 
Hi Tim,

I am also having this problem with the ButtonEx when I put an image on a
button. (OpenNETCF SDF 1.1 with VB.NET) It is kinda annoying to do my
workaround, but whenever I see the error, I just find the same line that you
mentioned and comment it out. Whenever I reload the designer view, it puts
the line ImageAlign=MiddleCenter setting back in the code, so then I just
comment it out again. I can't see any adverse effects to my programs, so
I'll keep doing it. I'd like to see what I'm doing wrong though.

-Scott
 
I'll continue to investigate this issue when I get some more time. But it's
odd that people are saying that this worked fine in 1.0 but not in 1.1. I
don't believe that any changes were made in this area between those builds.
Unless something funky happened during the 1.1 build? I dunno.
 
Back
Top