Xin cac anh chi chi dum em code Visual Basic cua dong ho dem nguoc de ung dung vao cuoc thi tri thuc tre cua truong em.
Y tuong cua em nhu the nay:
- co mot cmd1
- co hai textbox1 va textbox2
bay gio ta nhap thoi gian vao textbox1 (tinh bang giay) > nhap cmd1 thi textbox2 hien thi thoi gian tra lui lai (theo thoi gian da nhap o textbox1). Em xin cac anh chi chi dum em. Em biet on cac anh chi rat nhieu!
Nguyen Viet Cuong
Hoi am:
Rat don gian, ban tao mot form trong do co cac controler sau:
Text1
Text2
Command1
Timer1
nhan dup chuot len bat cu controller nao, sau do copy va paste phan ma sau day vao, de len tat ca nhung gi ban thay trong phan code:
Dim i As Long
Private Sub Command1_Click()
"set the countdown to change every one second.
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
"every one second text2.text will be one digit less than that of the text1.text
Text2.Text = Str(Val(Text1.Text) - i)
i = i + 1 "stop the countdown when text2.text reaches 0
If Trim(Text2.Text) = "0" Then
Timer1.Interval = 0
End If
End Sub
Dong Ngo