Can't get a value from my app.config file

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Winforms, Vs2003
Code is

Dim MyAppMgr as new System.configuration.AppsetingsReader
Me.txextbox1.text = MyAppMgr.Getvalue("MyServerName",string)
The IDE tells me that string is aclass type and so is not a valid
expression.
I know I'm trying to retrieve a string value so what's the proper syntax?

Any help would be appreciated.

Bob
 
Bob said:
Winforms, Vs2003
Code is

Dim MyAppMgr as new System.configuration.AppsetingsReader
Me.txextbox1.text = MyAppMgr.Getvalue("MyServerName",string)
The IDE tells me that string is aclass type and so is not a valid
expression.
I know I'm trying to retrieve a string value so what's the proper
syntax?

The second parameter must be a type object, not a type name:

Me.txextbox1.text = MyAppMgr.Getvalue("MyServerName", gettype(string))


Armin
 
to get a value from your app.config file:

Imports System.Configuration.ConfigurationSettings

dim aa as string
aa = System.Configuration.ConfigurationSettings.AppSettings("Key")

hope this works
 
Back
Top