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 / Design Time / June 2004

Tip: Looking for answers? Try searching our database.

Making a property editable ONLY BY CUSTOM EDITOR

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Foust - 15 Jun 2004 18:04 GMT
I have a property which is a basic type and I have a custom editor on the
property. The value of the property shows up as editable with the "..."
button to launch the custom editor. However I want to PREVENT the user from
editing the value by simply typing it in. I want to force the user to launch
the custom editor. Is there a secret attribute to do this?

Thanks
Bill
"Ying-Shen Yu[MSFT]" - 16 Jun 2004 09:36 GMT
Hi Bill,

You may try specifying a Type Converter class for your property,
here is a quick sample shows how to do this, for simplicity I defined a
Property in Font type, you may add this code snippet to a user control then
add the user control to the Form, now the MyFont property displays a string
returned from Font.ToString() and a button with "...",  you may edit the
value using Font Dialog but the text field of the property is not editable.

<code>
[   
    TypeConverter(typeof(TypeConverter))
]
public Font MyFont
{
    get
    {
        return this.Font;
    }
    set
    {
        this.Font = value;
    }
}
<code>
Does it resolve your probem?
Feel free to reply this thread if you have anything unclear about it.

Have a nice day!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.

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.