how to read value from xml file. for example i have booth id stored in xml and i want to read the id number in vb.net. how do i do that.

6 Years
Discussion Span
Last Post by swathys


i just posted private, actualy i try to get kioskno (from xml) but i have no idea i doesn't want to read the value from xml. i have no idea where goes wrong with the code.
please guide me

Edited by swathys: n/a



i really have problem read value from xml. i have no idea whats wrong with the code.
Can anyone HELP ME PLEASE !!!!

this id the code i coded at form load

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        xmlKioskNo = ReadRetailerSettingXML(strXMLPath, 0)
         Label3.Text = Format(CreditBalance(), "RM" & vbTab & "#,###,###.00")
    End Sub

and this is i coded at module level

Public Function ReadRetailerSettingXML(ByVal strXMLPath As String, ByVal LoopID As Integer) As String
        Dim xmlRoot As MSXML.IXMLDOMElement
        Dim objDOMXML As New MSXML.DOMDocument
        Dim intNodesLength As Short
        Dim a As Integer = 0
        Dim stroutput As String = ""

        strXMLPath = RBMKioskPath

        objDOMXML.resolveExternals = True
        objDOMXML.validateOnParse = True
        objDOMXML.async = False
        Call objDOMXML.load(strXMLPath)
        xmlRoot = objDOMXML.documentElement
        If xmlRoot.baseName = "Configuration" Then
            If xmlRoot.childNodes.item(LoopID).hasChildNodes = True Then
                intNodesLength = xmlRoot.childNodes.item(LoopID).childNodes.length
                xmlRoot = xmlRoot.childNodes.item(LoopID).firstChild
                For a = 0 To intNodesLength - 1
                    If xmlRoot.attributes.item(0).text = "Knumber" Then
                        xmlKioskNo = xmlRoot.text
                                          End If

                    xmlRoot = xmlRoot.nextSibling
                Next a

                       End If
        End If
    End Function
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.