Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.
I am trying to create a new property FileName in my User control, but I can not appear in the Visual Studio Property Grid at this property ellipse button to select a file. At a demonstration following are examples:

VB.NET
Private _NS As String = ""
<Category("Vlastnosti")> _
<Browsable(True)> _
<Description("Filename")> _
<DefaultValue(GetType(String), "List.txt")> _
<Editor(GetType(System.Web.UI.Design.UrlEditor), _ GetType(System.Web.UI.Design.UrlEditor))> _
Public Property FileName() As String
    Get
        Return _NS
    End Get
    Set(ByVal value As String)
        _NS = value
    End Set
End Property



No matter what I do, I'm still unable to appear in Visual Studio property grid for this property button file selection. You advise me where I'm wrong?

What I have tried:

How do I create FileName property in User control for Visual studio ?
Posted
Updated 8-Apr-16 6:24am
v3
Comments
an0ther1 20-Mar-16 21:29pm    
You will need to recompile your application after adding the new Property to your control, otherwise Visual Studio may not see it.
If the User Control is built outside of your current project you may need to remove and re-add your reference.
Kind Regards

1 solution

Yes, as it says an0ther1 you need to recompile the project (or the solution) in order to make the property appear. There was nothing wrong with your code.

TIP: When you make a new property for your own controls, is very helpfull start this properties like "_PropertyName". Then, when you are programming, is more easy to find them ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900