How do I get a file browse button in the property grid?

How do I get a file browse button in the property grid?

Post by Harr » Sat, 05 Oct 2002 22:05:40



Thanks .... I tried it but I still have no button showing up when i click
the FileName property.

BTW - is there another namespace using 'Editor' ? Just wondering why
removing the full qualifier for the namespace may have solved the problem?
Actually I had "Imports System.ComponentModel" in my class file - when i
removed 'Editor' wasn't resolved so it wouldn't work. With the Imports in
and only 'Editor' used it didn't show the button.

Any other suggestions?



Quote:> Harry-

> This works perfectly fine for me:

>     <Editor("System.Windows.Forms.Design.FileNameEditor", _
>     "System.Drawing.Design.UITypeEditor")> _
>     Public Property FileName() As String
>         Get
>             Return m_String
>         End Get
>         Set(ByVal Value As String)
>             m_String = Value
>         End Set
>     End Property

> The only difference is the System.ComponentModel stuff. . .See if that
makes
> a difference for you . . .

> > I've added reference to System.Design.Dll and also the following code,
> > however I am still unable to show ellipsis button in the property
window.

<System.ComponentModel.Editor("System.Windows.Forms.Design.FileNameEditor",

- Show quoted text -

Quote:> > _
> > "System.Drawing.Design.UITypeEditor")> _
> >     Public Property ImagesFile() As String
> >         Get
> >             Return sImagesFile
> >         End Get
> >     Set(ByVal Value As String)
> >             sImagesFile = Value
> >     End Set
> > End Property

> --
> Jacob Grass
> Microsoft .NET MVP
> Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Jacob Grass [MVP » Wed, 09 Oct 2002 04:07:44



> Thanks .... I tried it but I still have no button showing up when i click
> the FileName property.

Well, I am at a loss. . . Have you recompiled the control/object containing
this property?

Quote:> BTW - is there another namespace using 'Editor' ? Just wondering why
> removing the full qualifier for the namespace may have solved the problem?

The only reason I suggested it is that some of the attributes in VB.NET
right now aren't quite consistent.  I thought that this might be one of
those cases.

Quote:> Actually I had "Imports System.ComponentModel" in my class file - when i
> removed 'Editor' wasn't resolved so it wouldn't work. With the Imports in
> and only 'Editor' used it didn't show the button.

> Any other suggestions?

Beyond recompiling (which I am sure you have done)...  What kind of object
is this?  Is it a control?

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Jacob Grass [MVP » Fri, 11 Oct 2002 01:07:01


Hi Harry-

Quote:> I'm using the System.Windows.Forms.PropertyGrid

> Attached is my test project (1 class / 2 properties, and 1 form)
> demonstrating the problem.

Okay, I have it working in your project.  I wasn't testing it at runtime
before.  Change the attribute to look like this:

<Editor(GetType(System.Windows.Forms.Design.FileNameEditor), _
        GetType(System.Drawing.Design.UITypeEditor))> _

I wish I could explain why there is such an inconsistency at runtime versus
designtime.  But, the above will work for you.

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Harr » Sat, 12 Oct 2002 14:38:07


Hi Jacob,

Sorry I must be missing something.

I receive the following error:

Type 'System.Windows.Forms.Design.FileNameEditor' is not defined.

I looked in the object browser & can't find a "FileNameEditor" class under
"Windows.Forms.Design" namespace.

I'm running net framework SP2 - do you think that could be the problem?



Quote:> Hi Harry-

> > I'm using the System.Windows.Forms.PropertyGrid

> > Attached is my test project (1 class / 2 properties, and 1 form)
> > demonstrating the problem.

> Okay, I have it working in your project.  I wasn't testing it at runtime
> before.  Change the attribute to look like this:

> <Editor(GetType(System.Windows.Forms.Design.FileNameEditor), _
>         GetType(System.Drawing.Design.UITypeEditor))> _

> I wish I could explain why there is such an inconsistency at runtime
versus
> designtime.  But, the above will work for you.

> --
> Jacob Grass
> Microsoft .NET MVP
> Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Jacob Grass [MVP » Sat, 12 Oct 2002 23:04:27



> Hi Jacob,

> Sorry I must be missing something.

> I receive the following error:

> Type 'System.Windows.Forms.Design.FileNameEditor' is not defined.

> I looked in the object browser & can't find a "FileNameEditor" class under
> "Windows.Forms.Design" namespace.

> I'm running net framework SP2 - do you think that could be the problem?

Do you have a project reference to the System.Design.DLL ?

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Jacob Grass [MVP » Sat, 12 Oct 2002 23:27:44


Quote:>> Sorry I must be missing something.

>> I receive the following error:

>> Type 'System.Windows.Forms.Design.FileNameEditor' is not defined.

>> I looked in the object browser & can't find a "FileNameEditor" class
>> under "Windows.Forms.Design" namespace.

>> I'm running net framework SP2 - do you think that could be the problem?

> Do you have a project reference to the System.Design.DLL ?

I mean, of course, a reference in your project to that DLL. . .

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Harr » Tue, 15 Oct 2002 13:30:11


Thank you Jacob for your persistance and patience.

All working ok now after adding the reference.

Regards
Harry



Quote:> >> Sorry I must be missing something.

> >> I receive the following error:

> >> Type 'System.Windows.Forms.Design.FileNameEditor' is not defined.

> >> I looked in the object browser & can't find a "FileNameEditor" class
> >> under "Windows.Forms.Design" namespace.

> >> I'm running net framework SP2 - do you think that could be the problem?

> > Do you have a project reference to the System.Design.DLL ?

> I mean, of course, a reference in your project to that DLL. . .

> --
> Jacob Grass
> Microsoft .NET MVP
> Check out http://windowsforms.net

 
 
 

How do I get a file browse button in the property grid?

Post by Jacob Grass [MVP » Wed, 16 Oct 2002 00:20:39



> Thank you Jacob for your persistance and patience.

My pleasure. . .

Quote:

> All working ok now after adding the reference.

Fantastic.

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net

 
 
 

1. How do I get a file browse button in the property grid?

Has anyone an explanation to this problem?

I am not creating a user control. I simply want to allow user to click
button next to file name in the PropertyGrid and have the popup for user to
select file using dialog box.

I've added reference to System.Design.Dll and also the following code,
however I am still unable to show ellipsis button in the property window.

<System.ComponentModel.Editor("System.Windows.Forms.Design.FileNameEditor",
_
"System.Drawing.Design.UITypeEditor")> _
    Public Property ImagesFolder() As String
        Get
            Return sImagesFolder
        End Get
    Set(ByVal Value As String)
            sImagesFolder = Value
    End Set
End Property

Do I still need some additional code for TypeConverters ?

Regards
Harry


<System.ComponentModel.Editor("System.Windows.Forms.Design.FileNameEditor",

2. Overburning with CDR Win

3. Browsing the file system and getting the path to a file

4. Overlay for BIOS to use 2nd IDE port??

5. VB.net : configuring a button to browse windows file directory

6. LaTeX manual

7. Uploading File / Event for browse button ?

8. Programming Alteras from an embedded processor

9. C# Property Grid Button

10. .NET Add-ins in Excel do not show up in Add-ins

11. Property Not appearing in the Property Grid at Runtime

12. protected properties in Property Grid

13. Property Grid not showing Extended Property at Run time - why?