How do you use the GetValue method in Visual Basic .NET???

I get a compiler error from the code below, "Expected ','". At least it looks like a comma. I've used the function from C Sharp by using a similar statement, but I have a project in VB.

Please help!!!

Rant: this kind of thing makes me hate Microsoft. This functionality could be so much easier!!!
Imports System.Configuration 'for settings
 
Dim Settings As AppSettingsReader = New AppSettingsReader()
 
Dim Addresses As String = Settings.GetValue("AlliedQuoteRequestEmailAddress", typeof(System.String))

Open in new window

LVL 1
CRESLISAAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Jeff CertainConnect With a Mentor Commented:
TypeOf does something completely different in VB :)
		Dim Settings As New System.Configuration.AppSettingsReader
		Dim Addresses As String = Settings.GetValue("AlliedQuoteRequestEmailAddress", GetType(System.String))

Open in new window

0
 
CRESLISAAuthor Commented:
actually, your code still needs to be cast to a string, but that was no problem
0
 
Jeff CertainCommented:
Ah... depends if you have option explicit on or not :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.