|
I replied to your other thread, but you should be using the XMLDataSource and it's Save method to save the XML.
I beleive you should just be able to add nodes by creating a new node entry.
TreeNode newNode = new TreeNode();
newNode.Text = row["CategoryName"].ToString();
newNode.Value = row["CategoryID"].ToString();
newNode.PopulateOnDemand = true;
newNode.SelectAction = TreeNodeSelectAction.Expand;
node.ChildNodes.Add(newNode);
|
|
|
|
|
I have a stand-alone class library project with an app.config file. I compile this file and place the compiled dll/config file into the bin\debug folder of the application described below.
I have an application project that includes a reference to that class library (the DLL that's in the bin\debug folder). This application also has an app.config file.
When I run the app, it instantiates a class in the class library assembly which tries to read the dll file's config file. .Net pukes at this claiming:
Configuration system failed to initialize
When I inspect the detail of the crash, I find this:
Only one <configsections> element allowed per config file and if present must be the first child of the root <configuration> element. (C:\\Work\\MyApp\\bin\\Debug\\MyApp.vshost.exe.config line 278)"}</configuration></configsections>
What's going on here?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Can you post line 278?
It's likely that a node has been defined twice and the schema for the configuration settings only allows it to be defined one. An example of this I ran into was when I thought that (for example) the urlMappings elements of the web.config file hadn't been defined, so added my own, only to find that it had been declared somewhere else and I'd just missed it.
|
|
|
|
|
AFAIK, the dll will use the executable's config file. Did you try to put the settings from the dll config into the exe config file?
|
|
|
|
|
That would completely eliminate the reason for having the DLL.
The DLL has it's own config file because the settings in that config file only apply to the DLL, and are otherwise invisible to the app that uses the DLL.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John - by default, the DLL config file is ignored. In order to actually do this, you have to load your DLL into its own AppDomain and use remoting to use the DLL. Here's a sample to get you started:
private _myClass;
public void SetupDomain(string configFile, string domainName)
{
AppDomainSetup setup = new AppDomainSetup();
setup.ConfigurationFile = configFile;
AppDomain domain = AppDomain.CreateDomain(domainName, null, setup);
_myClass = (MyDllClass)domain.CreateInstanceAndUnwrap("MyDll", "MyDll.MyDllClass");
} You could call this like:
SetupDomain("MyDll.Dll.Config", "My domain");
int value = _myClass.GetConfigItem();
|
|
|
|
|
I did it this way (the code below was abstracted a bit to keep it from overwhelming CP):
public class MyLibClass
{
private string m_configName = "MyLib.dll.config";
private string keyName = "APP_CONFIG_FILE";
public MyLibClass()
{
Reload();
}
public void Reload()
{
string configPath = System.IO.Path.Combine(Environment.CurrentDirectory, m_configName);
string appConfigFile = AppDomain.CurrentDomain.GetData(keyName).ToString();
AppDomain.CurrentDomain.SetData(keyName, configPath);
string xyz = ConfigurationManager.AppSettings["mySetting"];
AppDomain.CurrentDomain.SetData(keyName, appConfigFile);
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
how to make call for play recorded .wav file in linux asterisk server using asterisk.net?i have tried with playback() funtion as well as monitor() function but it cant work.please help me if anybody knows?
|
|
|
|
|
I use the PlaySound API function to play wav files, but I've only used it for local media.
[System.Runtime.InteropServices.DllImport ( "Winmm" , SetLastError=true , EntryPoint="PlaySound" )]
private static extern bool
API_PlaySound
(
string pszSound
,
System.IntPtr hmod
,
uint fdwSound
) ;
|
|
|
|
|
i am accessing the xml file through the c# in tree view. so how can i save the changes which ihave made in tree view in xml file?
|
|
|
|
|
when you read the file first time save the information with your self.
e,g save it in string what changing you are you going to made now you can easly change the string at the last you can write down you whole file again.
This is my idea i am working in this way.
|
|
|
|
|
can u plz send me sample code?
|
|
|
|
|
Look at the following overloads for the XmlDocument.Save() method. http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.save(VS.80).aspx[^]
I hope you were using the XmlDocument class to make the changes to the original XML. If you aren't, then you should definitely take a look there as it will make things easier for you.
I just realized you said you were using a databound treeview to access the XML. I've never actually used that, so ignore my response.
|
|
|
|
|
|
How to set dateformat in DataGridView column.
Which property need tobe changed or any other alternative???
|
|
|
|
|
You should change the date formate before putting the data into grid view.
If you are getting data from database then you should change your system date style formate.
|
|
|
|
|
But i want to write date manually in DataGridView how to do this???
|
|
|
|
|
There's a Format property in the DefaultCellStyle property in the GridViewColumn for setting the format.
|
|
|
|
|
|
I want to create custom picturebox in which i enter mouse i become inlage and as mouse leave in go in it previous size.
The problem did't want to big its size area.
I mean there are also other picturebox.
The example of my control that i what to create In mobile main menue.
In which which item you selected it will become large and over become over to nearest items.
rect.Inflate(2, 2);
is a technique but it not solving my problem.
Waiting for your comment ...
Thanks
|
|
|
|
|
Have you come up with any good ideas?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I get the answer form the msdn forms the link is
here]
|
|
|
|
|
Cool, and thanks for sharing
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I am using a property Grid with a check Box displayed as one of its item.
I am able to display Check Box and check/Uncheck Items.
But the problem is I am also getting a drop down List box with True/false along with check box. I need to get rid/hide this drop down List Box .
Can any pne please let me know for the soultion if possible ?
the code I am using for displying Check Box is:
[Editor(typeof(CheckBoxInPropertyGridEditorTwoPassCalc), typeof(System.Drawing.Design.UITypeEditor))]
public bool TwoPassCalculation
{
get { return twoPassCalculation; }
set { twoPassCalculation = value; }
}
public class CheckBoxInPropertyGridEditorTwoPassCalc : UITypeEditor
{
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
{
return true;
}
public override void PaintValue(PaintValueEventArgs e)
{
ControlPaint.DrawCheckBox(e.Graphics, e.Bounds, ((GeneralDimensionClass)e.Context.Instance).twoPassCalculation ? ButtonState.Checked : ButtonState.Normal);
}
}
modified on Wednesday, January 23, 2008 4:28:13 AM
|
|
|
|
|
Are you still working on this?
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|