Click here to Skip to main content
6,596,602 members and growing! (19,791 online)
Email Password   helpLost your password?
Languages » VB.NET » General     Intermediate

Bending .NET PropertyGrid to your will with a Custom Type Editor

By SoTTo

Example of using the propertybag class of Tony Allowatt in vb.net with a custom type editor
VB, Windows, .NET 1.0, .NET 1.1VS.NET2003, Dev
Posted:12 Jan 2004
Views:73,627
Bookmarked:25 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
12 votes for this article.
Popularity: 2.39 Rating: 2.22 out of 5
6 votes, 50.0%
1
1 vote, 8.3%
2

3
1 vote, 8.3%
4
4 votes, 33.3%
5

Sample Image - Propertygrid_Editor_demo.jpg

Introduction

I've had serious trouble doing these two things:

  • Using a propertygrid and having all of its properties (like the names of the properties, and description that is shown) dynamic, in VB.NET
  • Using Tony Allowat's classes (which solves the first problem) with a custom type editor

I finally managed to get things working ... and thought that others amongst you could be having the same problem as I ... So here it is, my working VB.NET version of Tony Allowatt's propertybag classes, implementing a custom type editor.

Background

I didn't write the code of the PropertyBag.vb file ... Tony Allowatt wrote these usefull classes for the propertygrid, but in C#. Read his article first! Bending the .NET PropertyGrid to Your Will

Using the code

I'm not going to explain much in here, as all the serious code has been explained by Tony Allowatt in his article. I only provide an example of how to use his classes with a custom editor.

Public Class MyOwnClass
 ' the class that will be shown in the propertygrid

 ' it has a property of typ MultiLineString

End Class 

Public Class MultiLineString
 ' this is the custom type we'll want to edit in the propertygrid

 ' it's just a class with 1 property, a string, but 

 ' we want a multiline editor for it


 ' ...

End Class

Public Class MultiLineStringEditor
 Inherits UITypeEditor
 ' ...

End Class

Public Class MultiLineStringConverter
 Inherits System.ComponentModel.TypeConverter
 ' ...

End Class

Public Class MultiLineStringEditorForm
 Inherits System.Windows.Forms.Form
 ' ...

End Class

Points of interest

Some interesting links:

History

  • 14-01-2004 - Initial Release

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

SoTTo


Member

Occupation: Web Developer
Location: Belgium Belgium

Other popular VB.NET articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 13 of 13 (Total in Forum: 13) (Refresh)FirstPrevNext
GeneralEasier Way Pinmemberbcryner6:48 27 Oct '08  
GeneralProperties are readonly... Pinmemberjack zucker11:46 28 Apr '05  
GeneralRe: Properties are readonly... PinmemberSpooler7:06 16 Sep '05  
Generalit does not really work Pinmemberzwark22:53 2 May '04  
GeneralRe: it does not really work PinmemberSoTTo23:45 2 May '04  
GeneralRe: it does not really work Pinmemberzwark0:00 3 May '04  
GeneralCollections PinmemberTLWallace11:55 14 Apr '04  
GeneralRe: Collections PinmemberSoTTo13:02 14 Apr '04  
GeneralDatabase example, please Pinmemberhuuhaa1:42 23 Jan '04  
GeneralRe: Database example, please PinmemberSoTTo8:44 25 Jan '04  
GeneralFlat Toolbar Look PinmemberTom Spink7:29 20 Jan '04  
GeneralRe: Flat Toolbar Look PinsussAnonymous1:18 21 May '04  
GeneralRe: Flat Toolbar Look PinmemberTom Spink6:42 21 May '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 12 Jan 2004
Editor: Nishant Sivakumar
Copyright 2004 by SoTTo
Everything else Copyright © CodeProject, 1999-2009
Web17 | Advertise on the Code Project