Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.33 KB | None | 0 0
  1. #Region "Form Events"
  2.     Private Sub SettingsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  3.         InitData()
  4.         InitUI()
  5.     End Sub
  6. #End Region
  7.  
  8. #Region "Data"
  9.     Private Sub InitData()
  10.         ImportsLanguageNames()
  11.     End Sub
  12.  
  13.     Private Sub ImportsLanguageNames()
  14.         'Load an xml file
  15.         'Generate a path for the languages.xml file
  16.         Dim path As String = Application.StartupPath & "\data\languages.xml"
  17.         'Deal with xml
  18.         Try
  19.             Dim xmlDoc As New XmlDocument
  20.             xmlDoc.Load(path)
  21.             Dim xmlRoot As XmlElement = xmlDoc.DocumentElement
  22.             'SetThe Progress Value
  23.             Me.MainDataSet.Language.Clear()
  24.             '  For i As Integer = 0 To xmlRoot.ChildNodes.Count - 1
  25.             For Each e As XmlElement In xmlRoot.ChildNodes
  26.                 Dim languageName As String = e.InnerText
  27.                 Dim languageValue As String = e.GetAttribute("value")
  28.  
  29.                 MainDataSet.Language.AddLanguageRow(languageName, languageValue)
  30.  
  31.             Next
  32.         Catch
  33.             MessageBox.Show("Can't find the file 'languages.xml'", "AfterCopy3.0", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
  34.             Me.Dispose(True)
  35.         End Try
  36.     End Sub
  37. #End Region
Add Comment
Please, Sign In to add comment