appsetting in class doesn't work
- From: "Robert Dufour" <bdufour@xxxxxxxxxx>
- Date: Thu, 16 Nov 2006 12:47:42 -0500
Here's the class code snippet
Imports System.Configuration.ConfigurationManager
Public Class Class1
Public _strTestSetting As String
Public Sub SetTestsetting()
_strTestSetting = AppSettings.Get("TestSetting") -should get the value of
TestSetting in app config file
End Sub
End Class
This is the snippet in the project calling the class -Project TestIt - To
test you should have a setting named TestSetting application scope, value
Testvalue
Imports System.Configuration
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim mycls As New clsTestconfig.Class1
mycls.SetTestsetting()
Label1.Text = mycls._strTestSetting
End Sub
End Class
There's a setting TestSetting in the settings file of the project Testit
Put a breakpoint on line
_strTestSetting = AppSettings.Get("TestSetting")
Click the button, you will see as you step over the breakpoint that the
value of _strTestSetting stays at nothing. ie, its not picking up the value
of TestSetting in app.config.
How can I get this pickup of the value to work?
Thanks for any help
Bob
.
- Follow-Ups:
- Re: appsetting in class doesn't work
- From: Steve Long
- Re: appsetting in class doesn't work
- Prev by Date: Re: RaiseEvent
- Next by Date: Re: Configuring the VB 6 to VB 2005 Converter (WAS: Re: VB 6 developers and .Net)
- Previous by thread: Re: Export function from VB.Net DLL
- Next by thread: Re: appsetting in class doesn't work
- Index(es):