Wednesday, 17 October 2007

Petrol Pumps (ticking display)

To get the ticking display to display the numbers in order instead of from left to right, I had to make sure the display always used three digits in processing. I used this code:

totalvalues = totalvalues + 1
Label1.Text = totalvalues

If Label1.Text.Length = 1 Then
Label1.Text = ("00") + Label1.Text
ElseIf Label1.Text.Length = 2 Then
Label1.Text = ("0") + Label1.Text
End If

Where "Label1" is the value of the petrol and it is this value to be displayed.
(this is on the tick event of the timer).

No comments: