B
bede
I have the following in my config file :
Code:
<configuration>
<appSettings>
<add key="ServerIPAddress" value="127.0.0.14444" />
</appSettings>
</configuration>
To update the node I use the following :
Code:
Dim doc As New XmlDocument() configName = "myconfig.config"
doc.Load(configName ) 'ServerIPAddress
Dim elServerIPAddress As XmlElement =
DirectCast(doc.SelectSingleNode("/
configurationappSettingsadd[@key='ServerIPAddress']"), XmlElement)
If elServerIPAddress IsNot Nothing
Then
elServerIPAddress.SetAttribute("value", Me.txtServerIP.Text)
End If
Which works fine but what I want to know is :
If the node does not exist how do I create it ?
Thanks in Advance folks
Code:
<configuration>
<appSettings>
<add key="ServerIPAddress" value="127.0.0.14444" />
</appSettings>
</configuration>
To update the node I use the following :
Code:
Dim doc As New XmlDocument() configName = "myconfig.config"
doc.Load(configName ) 'ServerIPAddress
Dim elServerIPAddress As XmlElement =
DirectCast(doc.SelectSingleNode("/
configurationappSettingsadd[@key='ServerIPAddress']"), XmlElement)
If elServerIPAddress IsNot Nothing
Then
elServerIPAddress.SetAttribute("value", Me.txtServerIP.Text)
End If
Which works fine but what I want to know is :
If the node does not exist how do I create it ?
Thanks in Advance folks