Hola, como lo dice el título una forma de usar XML para guardar configuración.
Public Function LeerConfig(ByVal sNombre As String) As String
Dim sReturn As String = String.Empty
Dim dsConfig As New DataSet
If System.IO.File.Exists(Application.StartupPath & "\config.xml") Then
dsConfig.ReadXml(Application.StartupPath & "\config.xml")
Else
dsConfig.Tables.Add("Configuracion")
dsConfig.Tables(0).Columns.Add("Nombre", GetType(String))
dsConfig.Tables(0).Columns.Add("Valor", GetType(String))
End If
Dim dr() As DataRow = dsConfig.Tables("Configuracion").Select("Nombre = '" & sNombre & "'")
If dr.Length = 1 Then sReturn = dr(0)("Valor").ToString
Return sReturn
End Function
Public Sub GuadarConfig(ByVal sNombre As String, ByVal sValor As String)
Dim dsConfig As New DataSet
If System.IO.File.Exists(Application.StartupPath & "\config.xml") Then
dsConfig.ReadXml(Application.StartupPath & "\config.xml")
Else
dsConfig.Tables.Add("Configuracion")
dsConfig.Tables(0).Columns.Add("Nombre", GetType(String))
dsConfig.Tables(0).Columns.Add("Valor", GetType(String))
End If
Dim dr() As DataRow = dsConfig.Tables(0).Select("Nombre = '" & sNombre & "'")
If dr.Length = 1 Then
dr(0)("Valor") = sValor
Else
Dim drConfig As DataRow = dsConfig.Tables("Configuracion").NewRow
drConfig("Nombre") = sNombre
drConfig("Valor") = sValor
dsConfig.Tables("Configuracion").Rows.Add(drConfig)
End If
dsConfig.WriteXml(Application.StartupPath & "\config.xml")
End Sub
SALU2