如何在visual studio的用户控件中创建文件名属性? [英] How do I create filename property in user control for visual studio ?

查看:97
本文介绍了如何在visual studio的用户控件中创建文件名属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。

我正在尝试在我的用户控件中创建一个新属性FileName,但我无法在此属性椭圆按钮中出现在Visual Studio属性网格中以选择文件。以下演示示例:



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:

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







无论我做什么,我仍然无法在Visual Studio属性网格中出现此属性按钮文件选择。你告诉我我哪里错了?



我尝试过:



如何在Visual Studio的用户控件中创建FileName属性?




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 ?

推荐答案

是的,因为它说 an0ther1 您需要重新编译项目(或解决方案)以使属性显示。您的代码没有任何问题。



提示:当您为自己的控件创建一个新属性时,非常有帮助启动此属性,如_PropertyName。然后,当你编程时,更容易找到它们;)
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 ;)


这篇关于如何在visual studio的用户控件中创建文件名属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆