hi all
i need help regarding the timer and capture the letter and display it.how do i blink the letter for like 5sec and go to the next letter and if needed capture it on to the label.
example :
the letter "A" blink for 5 sec then "B" start to blink if the letter is needed it will be capture on to the label.
VB Code:
Private Sub Form_Load()
' Start the timer.
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
dim i as integer
For i = 0 To 0
' Toggle the color of the letter "A"
If Label1.ForeColor = vbRed Then
Label1.ForeColor = vbBlack
Else
Label1.ForeColor = vbRed
End If
Next i
End Sub
Last edited by surface; Jun 30th, 2005 at 03:06 AM.
i put this in the command box but it overwrite to the next letter how do i solve it, i need make it to a sentance and how do i solve the "space" to leave a spacing "backspace" to go back 1 spacing and "Clear" to clear away all the words in the label.sorry for the trouble
I downloaded your code. have no idea what you hope to accomplish with this form, but here is what your're missing:
Private Sub Label1_Click(Index As Integer)
If Index < 25 Then Label27 = Label27 & Chr$(Index + 65)
If Index = 25 Then Label27 = ""
If Index = 26 Then Label27 = Label27 & " "
If Index = 27 And Len(Label27) > 0 Then Label27 = Left$(Label27, Len(Label27) - 1)
End Sub
Add this sub to what you already had in the project you uploaded and it should work fine
by the way, if you're just starting out in VB, now is the perfect time to stop and switch to .Net (before you learn a lot of things you'll have to unlearn)
the code is for mouse when u click the letter would appear but i need the letter blink and use the command button to capture it to make it a sentence. cuz i will be using a push button switch using microcontroller to get the letter using the command button.sorry for the trouble
VB Code:
Private Sub Label1_Click(Index As Integer)
If Index < 25 Then Label27 = Label27 & Chr$(Index + 65)
If Index = 25 Then Label27 = ""
If Index = 26 Then Label27 = Label27 & " "
If Index = 27 And Len(Label27) > 0 Then Label27 = Left$(Label27, Len(Label27) - 1)
OKAY. I think I have the idea. kind of a PacMan hi - score type concept. the letters flash until you click one then that one flashes for 5 secs and goes to next one unless you click one too. Why can't you use my way and directly click them into the box?
Doesn't matter. very easy.
forget everything else
below is the code for the whole form:
VB Code:
Dim i As Integer
Dim time As Double
Option Explicit
Private Sub Command1_Click()
ShowLetter (i)
End Sub
Private Sub Form_Load()
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
If i >= Label1.Count Then i = 0
Dim t As Integer
For t = 0 To 27
If t <> i Then Label1(t).ForeColor = vbBlack
Next t
If Label1(i).ForeColor = vbRed Then
Label1(i).ForeColor = vbBlack
Else
Label1(i).ForeColor = vbRed
End If
time = time + 0.5
If time >= 5 Then
time = 0
i = i + 1
End If
End Sub
Private Sub Label1_Click(Index As Integer)
i = Index
End Sub
Private Sub ShowLetter(Index)
If Index < 25 Then Label27 = Label27 & Chr$(Index + 65)
If Index = 25 Then Label27 = ""
If Index = 26 Then Label27 = Label27 & " "
If Index = 27 And Len(Label27) > 0 Then Label27 = Left$(Label27, Len(Label27) - 1)