Using VB 6:
Hi I'm having a bit of trouble with this, I know what I've got to do (or rather one way of doing it) but I'm struggling with the actual implementation of my thoughts into code.
I've got a seven segment display, and the actual display is sorted more or less (i.e. If I were to create a text box and code, type in a number then it would appear correctly in a seven segment format.) But now I want to make this display act like a timer, where it just counts up on a button click event and stops on a button click event? How would I make it do this?
This is my select case code (in a module) for the display of the seven segment numbers:
CODE
Sub ConvertDigitToLCD(NumberToDisplay As Integer, DigitToChange As Variant)
For n = 0 To 6
DigitToChange(n).Visible = False
Next n
Select Case NumberToDisplay
Case 0
DigitToChange(0).Visible = True
DigitToChange(1).Visible = True
DigitToChange(2).Visible = True
DigitToChange(4).Visible = True
DigitToChange(5).Visible = True
DigitToChange(6).Visible = True
Case 1
DigitToChange(2).Visible = True
DigitToChange(5).Visible = True
Case 2
DigitToChange(1).Visible = True
DigitToChange(2).Visible = True
DigitToChange(3).Visible = True
DigitToChange(4).Visible = True
DigitToChange(6).Visible = True
Case 3
DigitToChange(1).Visible = True
DigitToChange(2).Visible = True
DigitToChange(3).Visible = True
DigitToChange(5).Visible = True
DigitToChange(6).Visible = True
Case 4
DigitToChange(0).Visible = True
DigitToChange(3).Visible = True
DigitToChange(2).Visible = True
DigitToChange(5).Visible = True
Case 5
DigitToChange(0).Visible = True
DigitToChange(1).Visible = True
DigitToChange(3).Visible = True
DigitToChange(5).Visible = True
DigitToChange(6).Visible = True
Case 6
DigitToChange(0).Visible = True
DigitToChange(1).Visible = True
DigitToChange(3).Visible = True
DigitToChange(4).Visible = True
DigitToChange(5).Visible = True
DigitToChange(6).Visible = True
Case 7
DigitToChange(1).Visible = True
DigitToChange(2).Visible = True
DigitToChange(5).Visible = True
Case 8
DigitToChange(0).Visible = True
DigitToChange(1).Visible = True
DigitToChange(2).Visible = True
DigitToChange(3).Visible = True
DigitToChange(4).Visible = True
DigitToChange(5).Visible = True
DigitToChange(6).Visible = True
Case 9
DigitToChange(0).Visible = True
DigitToChange(1).Visible = True
DigitToChange(2).Visible = True
DigitToChange(3).Visible = True
DigitToChange(5).Visible = True
DigitToChange(6).Visible = True
End Select
End Sub
I've tested the display a number of ways including using a scroll bar, and this is the code (I've commented out the bits only relevant to the scroll bar) which I've used:
CODE
Private Sub Form_Load()
Dim txtToDisplay As String
'txtToDisplay = "000.00"
'txtToDisplay = Format(HScroll1.Value / 10, "000.00")
ConvertDigitToLCD Mid(txtToDisplay, 1, 1), Digit1
ConvertDigitToLCD Mid(txtToDisplay, 2, 1), Digit2
ConvertDigitToLCD Mid(txtToDisplay, 3, 1), Digit3
'(txtToDisplay, 4, 1) is the decimal point
ConvertDigitToLCD Mid(txtToDisplay, 5, 1), Digit4
ConvertDigitToLCD Mid(txtToDisplay, 6, 1), Digit5
End Sub
I know it's a bit of a lengthy one, but could anyone help me out, or give me more direction? So I can get the code I need and put it in a button click event...I've been thinking I'll need to use a timer, there may be other ways around it though...
Thanks
Skisy.