mooman_fl Posted March 29, 2004 Posted March 29, 2004 Got my collections showing up just fine now as properties... One of the subproperties though will be a file name. I have the following code setting the property to call up an OpenFileDialog... <Editor(GetType(System.Windows.Forms.Design.FileNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _ Public Property FileName() As String Get Return _FileName End Get Set(ByVal Value As String) _FileName = Value End Set End Property So far so good... dialog comes up. The problem is that it is just a default one. I need it to have the following set for it: ....1. Title ....2. DefaultExt ....3. InitialDirectory How would this be done in this case? I haven't been able to find any information on this. Thanks! Quote "Programmers are tools for converting caffeine into code." Madcow Inventions -- Software for the Sanity Challenged.
mooman_fl Posted April 4, 2004 Author Posted April 4, 2004 (edited) Ok... found the solution for this and so I will post as follows since I didn't see it listed anywhere else on the net. In a separate class... [size=2][color=#0000ff]Public [/color][/size][size=2][color=#0000ff]Class[/color][/size][size=2][color=#000000] ExFileNameEditor[/color] [/size][size=2][color=#0000ff] Inherits[/color][/size][size=2] System.Windows.Forms.Design.FileNameEditor [/size][size=2][color=#0000ff] Protected [/color][/size][size=2][color=#0000ff]Overrides [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] InitializeDialog([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] _OFD [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Windows.Forms.OpenFileDialog) _OFD.Title = "My File Dialog" _OFD.Filter = "Text File (*.txt)|*.txt" _OFD.InitialDirectory = System.Environment.CurrentDirectory [/size][size=2][color=#0000ff] End[/color][/size][size=2][color=#0000ff]Sub End[/color][/size][size=2][color=#0000ff]Class[/color][/size] For your property us this instead... [size=2] <Editor([/size][size=2][color=#0000ff]GetType[/color][/size][size=2](ExFileNameEditor), [/size][size=2][color=#0000ff]GetType[/color][/size][size=2](System.Drawing.Design.UITypeEditor))> _[/size] Welcom to your custom FileNameEditor dialog... easy huh?:D Edited April 4, 2004 by mooman_fl Quote "Programmers are tools for converting caffeine into code." Madcow Inventions -- Software for the Sanity Challenged.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.