Hi,
I am using VB.NET to create a user control which has this property called FileName. For now, when this control is created, I need to type in a file name in the properties window since the property is String. What I want to do is change this property to a file chooser type so that I can browse the file I want and choose instead of typing in the file path manually.
Could any expert out there help me solve this?
Thanks in advance.
I am using VB.NET to create a user control which has this property called FileName. For now, when this control is created, I need to type in a file name in the properties window since the property is String. What I want to do is change this property to a file chooser type so that I can browse the file I want and choose instead of typing in the file path manually.
Could any expert out there help me solve this?
Thanks in advance.
Code:
<Bindable(True), Browsable(True), Category("More Options"), DefaultValue(""), Description("Set the name of the file.")> _
Public Property FileName() As String
Get
If ViewState(strFileName) Is Nothing Then
Return "Data.txt"
ElseIf Not File.Exists(strFileName) Then
Return "Data.txt"
Else
Return ViewState(strFileName)
End If
End Get
Set(ByVal value As String)
ViewState(strFileName) = value
End Set
End Property
Comment