J
JackRazz
Im having a problem with the <Browsable(True),
DefaultValue(Paths.CommonAppDataPath)> attribute in the Path property below. The
browser doesn't set the default value correctly when the component is dropped on a
form. When I change the property in the VS IDE property window, it remembers the
change, but when I run the app, the Path property in the component isn't set to the
same property as in the property window.
Any ideas on what I'm doing wrong??
Thanks - JackRazz
-------------------------------------------------------------------------------------
---
Public Sub New()
MyBase.new()
mPropertyList = New Hashtable()
InitializeComponent()
If Not Me.DesignMode Then
p = GetFilePath()
End If
End Sub 'New
'File Path
Public Enum Paths
AppPath
CommonAppDataPath
UserLocalAppDataPath
UserRoamingAppDataPath
End Enum
Private Const mDefaultPath As Paths = Paths.CommonAppDataPath
Private Shared mPath As Paths
<Browsable(True), DefaultValue(Paths.CommonAppDataPath)> _
Public Property Path() As Paths
Get
Return mPath
End Get
Set(ByVal Value As Paths)
mPath = Value
End Set
End Property
Private Function GetFilePath()
Dim s As String
Try
Select Case Path
Case Paths.AppPath
s = Application.ExecutablePath
Case Paths.CommonAppDataPath
s =
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
s += "\" + Application.ProductName
Case Paths.UserLocalAppDataPath
s =
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
s += "\" + Application.ProductName
Case Paths.UserRoamingAppDataPath
s =
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
s = s + "\" + Application.ProductName
End Select
Return s
Catch
End Try
End Function
DefaultValue(Paths.CommonAppDataPath)> attribute in the Path property below. The
browser doesn't set the default value correctly when the component is dropped on a
form. When I change the property in the VS IDE property window, it remembers the
change, but when I run the app, the Path property in the component isn't set to the
same property as in the property window.
Any ideas on what I'm doing wrong??
Thanks - JackRazz
-------------------------------------------------------------------------------------
---
Public Sub New()
MyBase.new()
mPropertyList = New Hashtable()
InitializeComponent()
If Not Me.DesignMode Then
p = GetFilePath()
End If
End Sub 'New
'File Path
Public Enum Paths
AppPath
CommonAppDataPath
UserLocalAppDataPath
UserRoamingAppDataPath
End Enum
Private Const mDefaultPath As Paths = Paths.CommonAppDataPath
Private Shared mPath As Paths
<Browsable(True), DefaultValue(Paths.CommonAppDataPath)> _
Public Property Path() As Paths
Get
Return mPath
End Get
Set(ByVal Value As Paths)
mPath = Value
End Set
End Property
Private Function GetFilePath()
Dim s As String
Try
Select Case Path
Case Paths.AppPath
s = Application.ExecutablePath
Case Paths.CommonAppDataPath
s =
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
s += "\" + Application.ProductName
Case Paths.UserLocalAppDataPath
s =
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
s += "\" + Application.ProductName
Case Paths.UserRoamingAppDataPath
s =
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
s = s + "\" + Application.ProductName
End Select
Return s
Catch
End Try
End Function