Hello,
I am having troubles saving configuration file.
I did the folloing: inherited from ConfigurationSe ction,
ConfigurationCo llection, ConfigurationEl ement to define my own element in
config file.
If I do the following:
using System.Configur ation;
System.Configur ation.Configura tion configFile;
this.configFile =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None);
DatabaseConnect ionSection dcs;
dcs = new DatabaseConnect ionSection();
DatabaseConnect ionSettings cn = new DatabaseConnect ionSettings();
cn.Name = "connectionName ";
dcs.Connections .Add(cn);
this.configFile .Sections.Add(D atabaseConnecti onSection.Name, dcs);
this.configFile .Save(Configura tionSaveMode.Fu ll);
everything works fine, I can save and load the settings on the next run.
Hoever I'd like to store the section in separate file.
So after dcs instantiation I did:
dcs.SectionInfo rmation.ConfigS ource = "DatabaseConnec tions.config";
on execution of the last line in above I get an exception "Object reference
not set to an instance of an object."
the config file has this file added:
<DatabaseConnec tions configSource="D atabaseConnecti ons.config" />
But the file itself isn't created and the application can't start on the
next run because of this.
I think, the problem is in the filePath or there is something else I need to
set in SectionInformat ion, but the docs aren't clear about that
CUIN Kaczy 0 2521 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Supra |
last post by:
i got "system error" when saving to xml file.
i am using checkbox1 control to xml. when user clicked checkbox and set
to true and press btnOk to conform and save it to xml
rw.WriteConfigInfo("User Modes", chkInvisible.Text,
chkInvisible.Checked, "PirateChat.xml")
the error occured in hightleighted in below :.......
Public Function WriteConfigInfo(ByVal aSection As String, ByVal aKey As
|
by: Supra |
last post by:
i got "system error" when saving to xml file.
i am using checkbox1 control to xml. when user clicked checkbox and set
to true and press btnOk to conform and save it to xml
rw.WriteConfigInfo("User Modes", chkInvisible.Text,
chkInvisible.Checked, "PirateChat.xml")
the error occured in hightleighted in below :.......
Public Function WriteConfigInfo(ByVal aSection As String, ByVal aKey As
|
by: cyberstrike |
last post by:
In the system.configuration namespace, is there any way to save a Dataset or
any other custom structure in a section? I know how to make a class and
derive it from the section class; however, any properties I want to save
within that class have to be basic types. Right now if I try to use a complex
type, then I get an error that it could not find the converter.
In the configuration application block I could write datasets and any kind
of...
|
by: SR |
last post by:
I am trying to use the Configuration object provided with the .NET 2.0
framework. I see that when I call the Save function it does update the
<application>.exe.config file. However, when I close the application and
check the <application>.exe.config file again, it has reverted back to how
it was when the application was started.
Is there something I am doing or not doing? Here is part of my code: (And
before anyone writes it, I know I...
|
by: Sky |
last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but
be Type, AssemblyName. Fair enough, get the reason. (Finally!).
As long as it doesn't cause tech support problems down the line...
What happens when my code is run on a station that only has framework 3.0 or
4.0, and this assembly, with version number defined for 2.0.0.0 , isn't
available. ...breaks?
Second question:
Does an assembly's PublicKeyToken change...
| |
by: Shannon Richards |
last post by:
Hello All: I have implemented a custom configuration section in my
app.config file as follows:
<configSections>
<section name="AdminUIConfig"
type="TestMgr.UIConfigSection,TestMgr"/>
</configSections>
<AdminUIConfig name="Admin" caption="Administrator"
captionLC="administrator">
|
by: Mike |
last post by:
Hi
I have problem as folow:
Caught Exception: System.Configuration.ConfigurationErrorsException:
An error occurred loading a configuration file: Request for the
permission of type 'System.Security.Permissions.FileIOPermission,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed. (machine.config) --->
System.Security.SecurityException: Request for the permission of type
|
by: Shaikh shahnawaz |
last post by:
Hi,
I have implement multiple file uploading progress bar with the help of flash and .net file is upload on my local machine but not working with server it's give error while uploading image on server. code is as follows.
this is flash object:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="550"...
|
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= |
last post by:
Hi misters,
I have an app.config (UTF-8 format file). I create an application winforms
for changes and save configuration programatically.
When I save changes the format file changes to ANSI :( but I need format
file UTF-8, and too when I open app.config and changed it, Visual Studio
save it like UTF-8.
Any suggestions or comments, please ? I need help about it
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |