J
Jeff
Göran A mentioned efficient use of resources in another thread. I'm still
new and know enough to make the code below work, but not enough to do it
well. There has to be a better way.
I'm creating a "progress indicator" that shows as increasingly more cells of
a table row becoming blue as a user goes further
through pages in a site. Because there are various ways to proceed through
the site, I do need to keep the dynamic part about calculating
the % complete as shown on the first line. The rest can be altered.
Could someone suggest a better method that wouldn't involve so many
calculations?
Thanks
Dim PercentageComplete As Integer = (AmountSoFar/ TotalAmount) * 100
Dim X As Integer
If PercentageComplete < 7 Then
X = 0
ElseIf PercentageComplete < 14 Then
X = 1
ElseIf PercentageComplete < 20 Then
X = 2
ElseIf PercentageComplete < 26 Then
X = 3
ElseIf PercentageComplete < 33 Then
X = 4
ElseIf PercentageComplete < 40 Then
X = 5
ElseIf PercentageComplete < 46 Then
X = 6
ElseIf PercentageComplete < 52 Then
X = 7
ElseIf PercentageComplete < 58 Then
X = 8
ElseIf PercentageComplete < 64 Then
X = 9
ElseIf PercentageComplete < 70 Then
X = 10
ElseIf PercentageComplete < 77 Then
X = 11
ElseIf PercentageComplete < 94 Then
X = 12
ElseIf PercentageComplete < 100 Then
X = 13
ElseIf PercentageComplete < 110 Then
X = 14
End If
Dim tr As New TableRow
For j As Integer = 1 To 15
Dim td As New TableCell
td.Height = 5
td.Width = 5
tr.Cells.Add(td)
Table2.Rows.Add(tr)
Next
For i As Integer = 0 To X
Table2.Rows(0).Cells(i).BackColor = Drawing.Color.Blue
Next
new and know enough to make the code below work, but not enough to do it
well. There has to be a better way.
I'm creating a "progress indicator" that shows as increasingly more cells of
a table row becoming blue as a user goes further
through pages in a site. Because there are various ways to proceed through
the site, I do need to keep the dynamic part about calculating
the % complete as shown on the first line. The rest can be altered.
Could someone suggest a better method that wouldn't involve so many
calculations?
Thanks
Dim PercentageComplete As Integer = (AmountSoFar/ TotalAmount) * 100
Dim X As Integer
If PercentageComplete < 7 Then
X = 0
ElseIf PercentageComplete < 14 Then
X = 1
ElseIf PercentageComplete < 20 Then
X = 2
ElseIf PercentageComplete < 26 Then
X = 3
ElseIf PercentageComplete < 33 Then
X = 4
ElseIf PercentageComplete < 40 Then
X = 5
ElseIf PercentageComplete < 46 Then
X = 6
ElseIf PercentageComplete < 52 Then
X = 7
ElseIf PercentageComplete < 58 Then
X = 8
ElseIf PercentageComplete < 64 Then
X = 9
ElseIf PercentageComplete < 70 Then
X = 10
ElseIf PercentageComplete < 77 Then
X = 11
ElseIf PercentageComplete < 94 Then
X = 12
ElseIf PercentageComplete < 100 Then
X = 13
ElseIf PercentageComplete < 110 Then
X = 14
End If
Dim tr As New TableRow
For j As Integer = 1 To 15
Dim td As New TableCell
td.Height = 5
td.Width = 5
tr.Cells.Add(td)
Table2.Rows.Add(tr)
Next
For i As Integer = 0 To X
Table2.Rows(0).Cells(i).BackColor = Drawing.Color.Blue
Next