L
Lou Civitella
Using the following code I am trying to save changes to a xml from a VB.Net
app.
' Save the changes to the config file.
Dim xmlDoc As New XmlDocument
Dim strAppWorkingDir As String =
Path.GetDirectoryName([Assembly].GetExecutingAssembly.GetName.CodeBase) &
"\Config.xml"
xmlDoc.Load(strAppWorkingDir)
xmlDoc.GetElementsByTagName("Server").ItemOf(0).InnerXml =
txtServer.Text
xmlDoc.GetElementsByTagName("Database").ItemOf(0).InnerXml =
txtDatabase.Text
xmlDoc.GetElementsByTagName("UserName").ItemOf(0).InnerXml =
txtUserName.Text
xmlDoc.GetElementsByTagName("Password").ItemOf(0).InnerXml =
txtPassword.Text
xmlDoc.GetElementsByTagName("TimeOut").ItemOf(0).InnerXml =
txtTimeOut.Text
xmlDoc.GetElementsByTagName("Timer").ItemOf(0).InnerXml =
txtTimer.Text
Try
xmlDoc.Save(strAppWorkingDir)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Function
End Try
MessageBox.Show("Settings Saved")
When the code hits the Save line I get this error message: URI formats are
not supported
Here is what the config file looks like:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<UserName>sa</UserName>
<Password>1234</Password>
<Database>Application</Database>
<Server>SQL</Server>
<TimeOut>30</TimeOut>
<Timer>5</Timer>
</Configuration>
What does this mean and how can I fix this problem?
Thanks,
Lou
app.
' Save the changes to the config file.
Dim xmlDoc As New XmlDocument
Dim strAppWorkingDir As String =
Path.GetDirectoryName([Assembly].GetExecutingAssembly.GetName.CodeBase) &
"\Config.xml"
xmlDoc.Load(strAppWorkingDir)
xmlDoc.GetElementsByTagName("Server").ItemOf(0).InnerXml =
txtServer.Text
xmlDoc.GetElementsByTagName("Database").ItemOf(0).InnerXml =
txtDatabase.Text
xmlDoc.GetElementsByTagName("UserName").ItemOf(0).InnerXml =
txtUserName.Text
xmlDoc.GetElementsByTagName("Password").ItemOf(0).InnerXml =
txtPassword.Text
xmlDoc.GetElementsByTagName("TimeOut").ItemOf(0).InnerXml =
txtTimeOut.Text
xmlDoc.GetElementsByTagName("Timer").ItemOf(0).InnerXml =
txtTimer.Text
Try
xmlDoc.Save(strAppWorkingDir)
Catch ex As Exception
MessageBox.Show(ex.Message)
Exit Function
End Try
MessageBox.Show("Settings Saved")
When the code hits the Save line I get this error message: URI formats are
not supported
Here is what the config file looks like:
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
<UserName>sa</UserName>
<Password>1234</Password>
<Database>Application</Database>
<Server>SQL</Server>
<TimeOut>30</TimeOut>
<Timer>5</Timer>
</Configuration>
What does this mean and how can I fix this problem?
Thanks,
Lou