innertext html reading

Community,

 I have been able to identify a table, and pull all of the text from the table. So far I have it write the data from the table to a text file, however you get a list like my list below. I would like to read the order number and if status is complete to only pull that block. I would need help with the code on this one, thank you all very much. The data in the table changes, and is never static.

Order #:187
Forced:N
Client: 0013578
SKU Information:
SKU #1000011 - FULL SCREEN SETUP
SKU #1100001 - CUSTOM WIRE WRAP
SKU #1200001 - STUDIO PADDING
SKU #1110002 - DESKTOP CHAIR
SKU #2840001 - TOWER POWER
SKU #6278011 - DELIVERY
Order Status:Complete
Order #:1877
Forced:N
Client: 0013578
SKU Information:
SKU #1000011 - FULL SCREEN SETUP
SKU #1100001 - CUSTOM WIRE WRAP
SKU #1200001 - STUDIO PADDING
SKU #1110002 - DESKTOP CHAIR
SKU #2840001 - TOWER POWER
SKU #6278011 - DELIVERY
Order Status:Open
Order #:978642
Forced:N
Client: 0013578
SKU Information:
SKU #1000011 - FULL SCREEN SETUP
SKU #1100001 - CUSTOM WIRE WRAP
SKU #1200001 - STUDIO PADDING
SKU #1110002 - DESKTOP CHAIR
SKU #2840001 - TOWER POWER
SKU #6278011 - DELIVERY
Order Status:Open
LVL 1
-GeekAsked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Try something like this out:
Public Class Form1

    'Example record:

    'Order #:187
    'Forced:N
    'Client: 0013578
    'SKU Information:
    'SKU #1000011 - FULL SCREEN SETUP
    'SKU #1100001 - CUSTOM WIRE WRAP
    'SKU #1200001 - STUDIO PADDING
    'SKU #1110002 - DESKTOP CHAIR
    'SKU #2840001 - TOWER POWER
    'SKU #6278011 - DELIVERY
    'Order Status:Complete

    Public Class Order
        Public OrderNumber As String
        Public SKUs As New List(Of String)
    End Class

    Private CompletedOrders As New List(Of Order)

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim line As String
        Dim OrderTag As String = "Order #:"
        Dim StatusCompleteTag As String = "Order Status:Complete"
        Dim SkuTag As String = "SKU #"
        Dim CurrentOrder As Order = Nothing

        ' Parse the file:
        CompletedOrders.Clear()
        Dim FileName As String = "C:\Users\Mike\Documents\SomeFile.txt" ' "c:\some folder\path\file.txt"
        Dim SR As New System.IO.StreamReader(FileName)
        While Not SR.EndOfStream
            line = SR.ReadLine
            If line.StartsWith(OrderTag) Then
                CurrentOrder = New Order
                CurrentOrder.OrderNumber = line.Remove(0, OrderTag.Length).Trim
            ElseIf line.StartsWith(SkuTag) Then
                If Not IsNothing(CurrentOrder) Then
                    CurrentOrder.SKUs.Add(line.Remove(0, SkuTag.Length).Split(" ")(0).Trim)
                End If
            ElseIf line.StartsWith(StatusCompleteTag) Then
                If Not IsNothing(CurrentOrder) Then
                    CompletedOrders.Add(CurrentOrder)
                End If
                CurrentOrder = Nothing
            End If
        End While
        SR.Dispose()

        ' Display the results:
        For Each CompleteOrder As Order In CompletedOrders
            Debug.Print("Order #" & CompleteOrder.OrderNumber)
            For Each SKU As String In CompleteOrder.SKUs
                Debug.Print("SKU #" & SKU)
            Next
        Next
    End Sub

End Class

Open in new window

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
...so based on your last couple of questions, are you wanting to get all the SKUs associated with each completed order?
0
 
-GeekAuthor Commented:
Changed the debug.print to a msgbox, and nothing pops up in the msgbox. I'm working on trying to get the result currently still.
0
 
-GeekAuthor Commented:
Had to tweek a string to OrderStatus:Closed ;) worked like a charm.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.