I have this program for Windows I’m working on. I’m grabbing the source from the HTMLViewer then looping through it until the page is loaded. I split the text into an array and then search the array strings to parse the data. Everything works but it is slow and I’m not sure what is slowing it down. Is it the HTMLviewer? I wouldn’t think it is the do while loop since I exit out of it after I see the page is loaded. After it runs I have a label that gets populated by the word “complete” and then a msgbox that says “done”. The label updates instantly but the msgbox does not fire until about 2 seconds after, leading me to believe the main thread is still running something. Below is a skeleton of my code. As mentioned the code works it is just slow. I removed some of the text since it wasn’t important.
---start do loop
do until racefound = "yes"
txtSource.Text = ""
dim b as ChromiumBrowserMBS = HTMLViewer1.ChromiumBrowserMBS
if b<>Nil then
dim c as ChromiumFrameMBS = b.mainFrame
if c<>Nil then
dim t as string = c.Source
txtSource.Text = t
end if
end if
lstSourceAr.RemoveAllRows
'check for page loaded by getting active track
re.SearchPattern = "span class=""name""|""details"""
oMatch = re.Search(txtSource.value)
while oMatch isA RegExMatch
fullMatchStr = oMatch.SubExpressionString(0)
if instr(fullMatchStr,"class=""name""") > 0 then
---page is loaded
racefound = "yes"
else
s = fullMatchStr
lstSourceAr = s.Split("<div ")
exit
end if
oMatch = re.Search
wend
Loop
----end loop
---parse array
for i = 0 to lstSourceAr.LastIndex
if instr(lstSourceAr(i),"id=""type") > 0 then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
elseif instr(lstSourceAr(i),"id=....... then
description = ....
end if
next
---done parsing show complete
lblRF.Text = "Complete"
---done show msgbox, this takes 2 seconds after the lblRF.Text is updated with "Complete".
msgbox("Done")