Function and Listview Values
Hi Guys,
I can't seem to see a solution to this problem, i have this function:
vb.net Code:
Function functionDisplayLoggedInAccountData(ByVal HTML As String)
Dim testStr As String = HTML
Dim startAt As Integer = 0
Dim lastIndex As Integer = 0
Do
lastIndex = startAt
'// The first apttern we are looking for
Dim rx As New Regex("<tr bgcolor=""lightgreen"">")
startAt = rx.Match(testStr, startAt).Index + 28
If startAt < lastIndex Then Exit Do
'// The second pattern we are looking for
rx = New Regex("(?<=<td nowrap>).*(?=</td>)")
'// The third pattern we are looking for
Dim rxNew = New Regex("(?<=<td>).*(?=</td>)")
Dim postIDNumber As Integer = rxNew.Matches(testStr, startAt).Item(0).Value
With formMain.mainListView.Items.Add(rx.Matches(testStr, startAt).Item(0).Value)
.SubItems.Add(rx.Matches(testStr, startAt).Item(1).Value)
.SubItems.Add(rx.Matches(testStr, startAt).Item(2).Value)
'// Do some string manipulation
Dim newString As String = rx.Matches(testStr, startAt).Item(3).Value.Replace("<a href=""/post/shwpst?pii=" & (postIDNumber) & "&db=lv"">", "")
Dim finalString As String = newString.Replace("</a>", "")
.SubItems.Add(finalString)
'// Colour the background
.BackColor = Color.PaleGreen
End With
Loop
Return True
End Function
Which works well, but there are 2 more html fields called:
td bgcolor="lightblue"
td bgcolor="lightgrey"
In my code i just look for the bgcolor="lightgreen" field, is there a way i can get all colours and display the listview background colour accordingly?
thanks guys
Graham
Re: Function and Listview Values
you can choose a color by a string name:
vb Code:
Color.FromName("Color.PaleGreen")
Re: Function and Listview Values
Hi Paul,
what i was trying to do was look for all the bgcolor tags in the html, currently i just look for Dim rx As New Regex("<tr bgcolor=""lightgreen"">") so when i find the green values, i colour the background green, when i retrieve all the blue values i turn the listview blue etc
thanks mate
Graham