Hi
I am new to VB and I tried to race three cars(label) and I draw a finishin line .I want my program tell me which car won the race.
**my second question is that I want my all three cars start the race when click the start button.
Private Sub Command1_Click()
Randomize
Label4.Left = 6000
aa = Int((Rnd * 500) + 1)
bb = Int((Rnd * 500) + 1)
cc = Int((Rnd * 500) + 1)
label1.Left = label1.Left + aa
label2.Left = label2.Left + bb
label3.Left = label3.Left + cc
If label1.Left = 5000 Then
Print "blue car won"
If label2.Left = 5000 Then
Print "black car won"
If label3.Left = 5000 Then
Print "yellow car won"
End If
End If
End If
End Sub
your forgot to put the END IF in
put a end if on the next line after all the prints
Please support one of my projects? TKForums.com Web Forum JavaScript Wiki
________________________
If somone helps you, please rate their post, by clicking the to rate their post
and now please help me with the following question,
I want my program write the numbers every time I click a button
so that I know how many tmes I clicked it
I do that in java script as
counter=0;
.......
........
counter++
how is it in VB?
thanks a lot
ok i made what i think your talkign about, the timer race races the cars every 500 milliseconds and the start race button just makes the casr moves once
Originally posted by merhaba
I want my program write the numbers every time I click a button
so that I know how many tmes I clicked it
I do that in java script as
counter=0;
.......
........
counter++
how is it in VB?
thanks a lot
it is real eassy to do, all u have to put in is a variable = the variable + 1
for example:
VB Code:
Private Sub Command1_Click()
Dim A as Long
A = A + 1
End Sub
is that what u want?
Please support one of my projects? TKForums.com Web Forum JavaScript Wiki
________________________
If somone helps you, please rate their post, by clicking the to rate their post