nbk5533

It is my hope that I would be able to create (or something similar to) another or I should say, additional <appSettings> elements. I realize there is only one by design, but, I've come across a few articles where it's written like this but I get failures as noted below. -->

<configSections>

<sectionGroup name="settings">

<section name="PSSMBNAManager" type="System.Configuration.NameValueSectionHandler"/>

<section name="PSSMBNAAgent" type="System.Configuration.NameValueSectionHandler"/>

</sectionGroup>

</configSections>

The problem is, I get an "InvalidOperationException was unhandled. An error occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception".

The intent here is to get around using just one "<appSettings></appSettings> element. I need more than one.

If anyone knows of some real good resources or just happened to implement something like this, I'm all ears. There just isn't any good examples of this anywhere on the Internet nor in any books that I've rummaged through so far.

Thank you,

Wallace



Re: Windows Forms General Create a new <appSettings> element in an app.Config file in vb.net?

Yu Guo ĘC MSFT

Hi, nbk5533,

I'm not sure that do you want multiple <section> sections or multiple <appSettings> sections

Maybe some more codes will help.

Regards






Re: Windows Forms General Create a new <appSettings> element in an app.Config file in vb.net?

Zhi-Xin Ye - MSFT

I'm afraid you cannot create a new <appSettings> element in app.config file, because it's a predefined configuration section which can be retrieved by the ConfigurationSettings.AppSettings property, if there're more than one <appSettings> exists, how can the ConfigurationSettings.AppSettings specify which one to read Maybe to create custom configuration sections is a better choice for you, for more information about creating custom configuration sections, see this article: http://www.codeproject.com/aspnet/ConfigSections.asp




Re: Windows Forms General Create a new <appSettings> element in an app.Config file in vb.net?

nbk5533

Thank you for the reply Zhi-Xim,

I did discover that I would have to delcare an Integer (i) variable and then use a For...Each loop to set a minimum/maximum Count to read the values I need to out of the <appSettings> section and store to that variable.

I realized that as well, how would the application know which section to read when you you needed it to. It would probably read the last <appSetttings> element and disregard all former elements.

Thank you for the link. I'll be sure to read up on it as soon as I have some time.

Wallace