Home All Groups Group Topic Archive Search About

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

Author
28 Jan 2006 6:33 PM
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

Author
28 Jan 2006 6:39 PM
Armin Zingler
"Bob" <bduf***@sgiims.com> schrieb
> 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
Author
20 Feb 2006 7:59 AM
aedessa aedessa
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


*** Sent via Developersdex http://www.developersdex.com ***