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 / November 2005

Tip: Looking for answers? Try searching our database.

Implement property like Textbox.Lines?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
frank.kintrup@gmx.de - 19 Nov 2005 21:22 GMT
Hi all,

been searching for a while now, but could not find anything useful.
But since I'm new to .NET and C# maybe I just could not identify if
something was a solution for my problem...

I'm writing a small component which uses a list of name/value pairs.
But I have no  idea how to implement this so that the list of strings
is exposed as a single property and can be edited at design time
like the Textbox.Lines property. Can anyone help?

Frank
Gabriel Lozano-Morán - 20 Nov 2005 19:19 GMT
With name/value pairs you mean a hashtable?

Gabriel
frank.kintrup@gmx.de - 20 Nov 2005 20:54 GMT
> With name/value pairs you mean a hashtable?

Well, not really. Internally it's just a bunch of strings like
"name=value" which are
passed to a legacy DLL via P/Invoke. Though accessing them in .NET with
a hash
interface like 'class.property["name"] = value' would be an
advantage...

Frank
InK_ - 21 Nov 2005 07:43 GMT
Hi!
I guessyou should set attribute your property as follows:
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Localizable(true), Description("Gets the collection of items displayed by
the current combo box editor."),
Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design",
typeof(UITypeEditor))]
public virtual StringCollection Items
{
     get
     {
           return this._items;
     }
}

As a result StringCollectionEditor will appear to edit your property.

Regards,
Inna Stetsyak aka InK_

> Hi all,
>
[quoted text clipped - 8 lines]
>
> Frank

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.