Thank you for visiting → Compete For ← If you find anything useful leave me a comment and share. Interested in Arduino, C#, Unity3D, Game Creation, VB.NET, learning and most important of all Sharing!.
Close Notification
Open Notification

VB.NET VS2010 Load Application Settings From XML

VB.NET VS2010 Load Application Settings From XML

Download Project Source Code ApplicationSettingsFromXML

It is very easy to pull String Settings from a simple XML. It makes it very easy to
change settings that you need in your application after you have compiled it.

Imports System.Xml

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'XML Settings file
        Dim Doc As New XmlDocument
        Dim Input As New XmlTextReader(Application.StartupPath & "\settings.xml")
        Input.WhitespaceHandling = WhitespaceHandling.None
        Do While Input.Read()
            If Input.NodeType = XmlNodeType.Element Then
                Select Case Input.Name
                    Case "applicationName"
                        Label1.Text = Input.ReadString()
                    Case "someText"
                        Label2.Text = Input.ReadString()
                End Select
            End If
    End Sub

End Class

Now for a simple XML file..

	Test Application
	Some Setting String

Leave a reply