Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / October 2004

Tip: Looking for answers? Try searching our database.

Control Properties

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
C# Learner - 28 Oct 2004 09:18 GMT
   class MyControl : TextBox
   {
       uint foo;

       public uint Foo {
           get {
               return foo;
           }
           set {
               foo = value;
           }
       }
   }

When I create an instance of this control with VS.NET's form designer, it
complains that 'Foo' isn't a CLS-compliant type and that it can't create
code that sets it.

How can I fix this?  And is how to fix this documented anywhere?

Creating a simple control that works with the form designer seems to be a
case of guessing how to do things and then using trial and error.  The MSDN
documentation is apparently useless here.
joeycalisay - 28 Oct 2004 11:35 GMT
How about attaching CLSCompliantAttribute(false) to your property

>     class MyControl : TextBox
>     {
[quoted text clipped - 19 lines]
> case of guessing how to do things and then using trial and error.  The MSDN
> documentation is apparently useless here.
C# Learner - 28 Oct 2004 12:15 GMT
> How about attaching CLSCompliantAttribute(false) to your property

Still no joy.  :-/
Herfried K. Wagner [MVP] - 28 Oct 2004 17:25 GMT
"C# Learner" <csharp@learner.here> schrieb:
>    class MyControl : TextBox
>    {
[quoted text clipped - 5 lines]
> complains that 'Foo' isn't a CLS-compliant type and that it can't create
> code that sets it.

Simply do not use unsigned types, they are not CLS compliant.  Instead, use
'short'/'int'/'long'.

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/

joeycalisay - 29 Oct 2004 02:09 GMT
Do you mean VS Form Designer only support full CLS for its codegen?

> "C# Learner" <csharp@learner.here> schrieb:
> >    class MyControl : TextBox
[quoted text clipped - 9 lines]
> Simply do not use unsigned types, they are not CLS compliant.  Instead, use
> 'short'/'int'/'long'.
Herfried K. Wagner [MVP] - 29 Oct 2004 11:17 GMT
"joeycalisay" <hcalisay@_spamkiller_codex-systems.com> schrieb:
> Do you mean VS Form Designer only support full CLS for
> its codegen?

I didn't check that, but I would try to avoid using unsiged types in object
interfaces.

Signature

Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.