Loop through the lines of a text file in VB.NET

后端 未结 3 1993
猫巷女王i
猫巷女王i 2020-12-19 21:37

I have a text file with some lines of text in it.

I want to loop through each line until an item that I want is found*, then display it on the screen, in the form of

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-19 21:59

    LOOPING AND GETTING ALL XML FILES FROM DIRECTORY IF WE WANT TEXTFILES PUT "*.txt" IN THE PLACE OF "*xml"

    Dim Directory As New IO.DirectoryInfo(Path)

        Dim allFiles As IO.FileInfo() = Directory.GetFiles("*.xml")
        allFiles = allFiles.OrderByDescending(Function(x) x.FullName).ToArray()
        Dim singleFile As IO.FileInfo
    
    
        For Each singleFile In allFiles
            'ds.ReadXml(singleFile)
            xd.Load(singleFile.FullName)
    
            Dim nodes As XmlNodeList = xd.DocumentElement.SelectNodes("/ORDER/ORDER_HEADER")
            Dim ORDER_NO As String = " "
            For Each node As XmlNode In nodes
                If Not node.SelectSingleNode("ORDER_NO") Is Nothing Then
                    ORDER_NO = node.SelectSingleNode("ORDER_NO").InnerText
                End If
            Next
    
        Next
    

提交回复
热议问题