Dataset WriteXML method

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

My apologies if this has appeared twice. I have had trouble hitting
this server. Anyway...

I have a .NET windows app that uses a small XML support file. I use
it in a recordset and the WriteXML method keeps it current. My
problem is getting a particular value to write

In the code below the txtBase.Text value is filled from the FileName
property of an OpenFileDialog object. This value will never write to
the XML. If, however, I merely type something into this text box
instead of getting it from the OpenFileDialog, (or even hardcode some
string value in the code), this method updates the XML with no
problem.

Anyone have any ideas of how to fix this??

Here's the code (dsSettings was filled earlier with the ReadXML
method)

Dim rwSystem As DataRow = dsSettings.Tables(0).Rows(0)

rwSystem("BaseDirectory") = txtBase.Text
dsSettings.AcceptChanges()
dsSettings.WriteXml("ProgramSettings.xml"
XmlWriteMode.WriteSchema)
 
OpenFileDialog will change your application default directory. Most
likely the valud has been written to another place. Set FileDialog's
RestoreDirectory property to be true will solve the problem.
 
Back
Top