Load all the children node of a node of app.config

Wednesday, February 18, 2009

Private Sub sloadSearchSetting()
Dim ary() As String
Dim icount As Integer
Dim doc As XmlDocument = loadConfigDocument()
Dim cnode As XmlNode
Dim KeyName As String
Dim KeyValue As String
Dim i As Integer
Dim XmlDoc As New XmlDocument()
XmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)
For Each xElement As XmlElement In XmlDoc.DocumentElement
If xElement.Name = "appSettings" Then
For Each xNode As XmlNode In xElement.ChildNodes
KeyName = xNode.Attributes(0).Value
KeyValue = xNode.Attributes(1).Value
grdSearchCenter.Rows.Insert(i, 1)
grdSearchCenter.Rows(i).Cells(0).Value = i + 1
grdSearchCenter.Rows(i).Cells(1).Value = KeyName
grdSearchCenter.Rows(i).Cells(2).Value = KeyValue
i += 1
Next
End If
Next

0 comments

Post a Comment