Click here to Skip to main content
15,897,187 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: An MVVM way to know when a database update is complete in order to navigate to another page. Pin
Mycroft Holmes7-Feb-11 19:28
professionalMycroft Holmes7-Feb-11 19:28 
QuestionAdd Controls Dynamically Using MVVM Pin
Kevin Marois3-Feb-11 8:20
professionalKevin Marois3-Feb-11 8:20 
AnswerRe: Add Controls Dynamically Using MVVM Pin
dasblinkenlight3-Feb-11 8:50
dasblinkenlight3-Feb-11 8:50 
GeneralRe: Add Controls Dynamically Using MVVM Pin
Kevin Marois3-Feb-11 9:04
professionalKevin Marois3-Feb-11 9:04 
AnswerRe: Add Controls Dynamically Using MVVM Pin
RobCroll3-Feb-11 13:37
RobCroll3-Feb-11 13:37 
AnswerRe: Add Controls Dynamically Using MVVM Pin
_Maxxx_3-Feb-11 15:31
professional_Maxxx_3-Feb-11 15:31 
AnswerRe: Add Controls Dynamically Using MVVM Pin
_Maxxx_3-Feb-11 15:54
professional_Maxxx_3-Feb-11 15:54 
QuestionHelp editing Xml file from code - C# Pin
jadughar3-Feb-11 5:46
jadughar3-Feb-11 5:46 
Hi
I'm trying to modify an Xml file. This is the content of the Xml. The problem is that after changes, it will creates a copy of the content of the Xml file without changing the old content.

Before changes :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="Application.Properties.Settings.DBConnectionString"
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB.mdb"
      providerName="System.Data.OleDb" />
  </connectionStrings>
</configuration>


After changes :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="Application.Properties.Settings.DBConnectionString"
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB.mdb"
      providerName="System.Data.OleDb" />
  </connectionStrings>
</configuration>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="Application.Properties.Settings.DBConnectionString"
      connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataBase\DB.mdb"
      providerName="System.Data.OleDb" />
  </connectionStrings>
</configuration>



The code is :
//xml document object
System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();

FileStream reader = new FileStream(this._XmlFilePath, FileMode.Open, FileAccess.ReadWrite);

xdoc.XmlResolver = null;

//load the xml file
xdoc.Load(reader);

System.Xml.XmlElement Node = (System.Xml.XmlElement)xdoc.DocumentElement.SelectSingleNode("//configuration/connectionStrings/add[@name=\"Application.Properties.Settings.DBConnectionString\"]");
if (Node != null)
{
    //key found, set the value
    Node.Attributes.GetNamedItem("Source").Value = "C:\DataDabe\DB.mdb";

    //finally, save the new version of the config file
    xdoc.Save(reader);
    reader.Close();
}

"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras

AnswerRe: Help editing Xml file from code - C# Pin
Pete O'Hanlon3-Feb-11 8:03
mvePete O'Hanlon3-Feb-11 8:03 
AnswerRe: Help editing Xml file from code - C# Pin
RobCroll3-Feb-11 13:54
RobCroll3-Feb-11 13:54 
AnswerRe: Help editing Xml file from code - C# Pin
Abhinav S3-Feb-11 20:30
Abhinav S3-Feb-11 20:30 
AnswerRe: Help editing Xml file from code - C# Pin
jadughar3-Feb-11 21:26
jadughar3-Feb-11 21:26 
Questionwpf Pin
arkiboys2-Feb-11 11:54
arkiboys2-Feb-11 11:54 
AnswerRe: wpf Pin
Pete O'Hanlon3-Feb-11 0:04
mvePete O'Hanlon3-Feb-11 0:04 
GeneralRe: wpf Pin
arkiboys3-Feb-11 0:17
arkiboys3-Feb-11 0:17 
Generalwpf, populate combobox accordingly Pin
arkiboys3-Feb-11 10:48
arkiboys3-Feb-11 10:48 
GeneralRe: wpf, populate combobox accordingly Pin
Pete O'Hanlon3-Feb-11 11:47
mvePete O'Hanlon3-Feb-11 11:47 
GeneralRe: wpf, populate combobox accordingly Pin
arkiboys3-Feb-11 11:52
arkiboys3-Feb-11 11:52 
AnswerRe: wpf [modified] Pin
Renat Khabibulin3-Feb-11 0:10
Renat Khabibulin3-Feb-11 0:10 
AnswerRe: wpf Pin
RichardGrimmer4-Feb-11 4:57
RichardGrimmer4-Feb-11 4:57 
QuestionWCF Policy File Pin
Vimalsoft(Pty) Ltd2-Feb-11 0:20
professionalVimalsoft(Pty) Ltd2-Feb-11 0:20 
AnswerRe: WCF Policy File Pin
Abhinav S5-Feb-11 18:02
Abhinav S5-Feb-11 18:02 
GeneralRe: WCF Policy File Pin
Vimalsoft(Pty) Ltd5-Feb-11 19:38
professionalVimalsoft(Pty) Ltd5-Feb-11 19:38 
QuestionDatabase Connectivity in Silverlight Web Application Pin
Sunil G 330-Jan-11 22:09
Sunil G 330-Jan-11 22:09 
AnswerRe: Database Connectivity in Silverlight Web Application Pin
Pravin Patil, Mumbai30-Jan-11 23:25
Pravin Patil, Mumbai30-Jan-11 23:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.