Android Question [SOLVED]Very Slow Loop

Fotios Georgiadis

Member
Licensed User
I have a for-loop where I fill with data a string variable (that I have already Created). It takes 6 to 10 secs to complete.

Log($"BEFORE loop- $time{DateTime.Now}"$)

Dim n As Int = crs.RowCount - 1

Dim lvHtml As String = $"<!DOCTYPE html><html><head><style>body{background-color:#FFF; margin:0;}table{width:100%; border:0px; padding:0; margin:0; border-collapse: collapse;border-spacing:0;}th, td {border: 0px solid black;border-collapse: collapse;}th, td {font-family:Helvetica;padding: 0px;text-align: left; font-size:3.7vw;}body > table > tbody > tr:nth-child(odd) {background-color: white; height:60px;}body > table > tbody > tr:nth-child(even) {background-color: #c9c9c9; height:60px;}table th {background-color: black;color: white;font-size:10px;}.ind { padding-left:10px; width: 10%; color: black;}.rider {width: 75%; color: black;} .rider2 {width: 75%; color: black;} .time {width: 15%; color: black;}.riderdata {width: 75%; color: black;}"$
lvHtml = lvHtml & $".handicap {width: 25%; color: red; text-align: right; padding-right:25px;}.time2 {width: 25%; color: black; text-align: right; padding-right:25px;}</style></head><body><table id="main">"$

For i = 0 To n - 1
crs.Position = i

Dim lvRiderData As String = crs.GetString("isrClass") & " " & crs.GetString("isrTrophy") & " " & crs.GetString("isrNationality") & " " & crs.GetString("isrBike")

Dim lvRiderName As String = crs.GetString("isrCode") & " " & crs.GetString("isrName")

lvHtml = lvHtml & $"<tr><td class="ind">"$ & crs.GetString("islIndex") & $"</td><td class="rider"><table id="rdata"><tr><td class="rider2">"$ & lvRiderName & $"</td></tr><tr><td class="riderdata">"$ & lvRiderData & $"</td></tr></table></td><td class="time"><table id="rdata"><tr><td class="time2">"$ & crs.GetString("islTime") & $"</td></tr><tr><td class="handicap">""$ & crs.GetString("islHandicap") & $"</td></tr></table></td></tr>"$

Next

Log($"AFter loop - $time{DateTime.Now}"$)


Any idea why this loop is taking too long to execute?
 
Top