Source Code. Чтение/запись XML

Скачать пример


Public Class Form1

Public Class NetSend2014_settings
Public Netsend2014server_ip As String
Public Netsend2014server_port As String
End Class

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim reader As New System.Xml.Serialization.XmlSerializer(GetType(NetSend2014_settings))
Dim file As New System.IO.StreamReader(
My.Application.Info.DirectoryPath & "\settings.xml")
Dim overview As NetSend2014_settings
overview = CType(reader.Deserialize(file), NetSend2014_settings)
TextBox1.Text = overview.Netsend2014server_ip
TextBox2.Text = overview.Netsend2014server_port
file.Close()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim overview As New NetSend2014_settings
overview.Netsend2014server_ip = TextBox1.Text
overview.Netsend2014server_port = TextBox2.Text
Dim writer As New System.Xml.Serialization.XmlSerializer(GetType(NetSend2014_settings))
Dim file As New System.IO.StreamWriter(
My.Application.Info.DirectoryPath & "\settings.xml")
writer.Serialize(file, overview)
file.Close()
End Sub
End Class