Dataset WriteSchema method

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hope this isn't posted twice. The other one disappeared...anyway -

Having trouble getting a particular value to stick with this method. I have
a little XML file to store some data for a .NET Windows application. I use
the WriteSchema method of the dataset I read it into to keep it updated.

In the code below, the text in the textbox txtBase is normally supplied by
the FileName property of an OpenFileDialog component. However, this text
value never will write to the file! If I restart the program and merely
type some text in the textbox, or if I hardcode a string value in the code,
the file is updated correctly.

Anyone know how to make this work??


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

rwSystem("BaseDirectory") = txtBase.Text
dsSettings.AcceptChanges()
dsSettings.WriteXml("ProgramSettings.xml", XmlWriteMode.WriteSchema)
 
Tom,
Can you provide more information or code where you set
the text box's text to the file name property of your OpenFileDialog
component? Using the code you provided, I was not able to reproduce your
problem for simple cases. I also tried providing special characters like
"\", "*" and it worked.

Regards,
Hema Nagarajan
VB Dot Net QA Team
 
Thanks for the reply. The method to fill the textbox is as follows:

Dim strPath As String
Dim x As New OpenFileDialog()

x.InitialDirectory = txtBase.Text
x.ShowDialog()
strPath = x.FileName
If strPath.Length > 0 Then
txtBase.Text = strPath
End If
 
Back
Top