I have Paste/Copy following code from a VB.NET
Winform application to a VB.NET
Console application
Dim oSettings = New My.Settings
sTracePath = oSettings.TracePath
sDataFolder = oSettings.DataFolder
I have also tried to define/create a Setting file in MyProject
folder as done for WinForm application; but builder continue to return following compiler error on first line of code !
My.Settings type is not defined
I have also tried to Paste/Copy Settings.settings
and Settings.Designer.vb
files from WinForm application to my Console application; but it doesn't work.
How can define a My.Settings
object in a VB.NET Console application so that I can access directly a Property as TracePath
or DataFolder
without using a String Key but in using a variable name ?
Is that possible for Console
VB.NET applications ?
I think that The Truth Is Out There
!
The correct VB.NET code is
Dim oSettings = New My.MySettings
or
Dim oSettings = My.Settings
but not
Dim oSettings = New My.Settings
My.MySettings
is the type and My.Settings
is a predefined objet of My.MySettings
type !
You can immediately use My.Settings
instead of oSettings
!