读书人

请问老师这句有关问题出在哪里?

发布时间: 2012-06-27 14:20:09 作者: rapoo

请教老师这句问题出在哪里???

VB code
Private Declare Function GetTickCount Lib "kernel32" () As LongPublic ite As LongPublic itc As LongPrivate Sub Form_Load()    ite = GetTickCount    Text2.Text = 2    Text1.Text = Val(Text2.Text) * 1200 + ite    Text3.Text = Text1.Text   End Sub


请问Val(Text2.Text) * 1200 + ite这句这样写为什么得出来的结果不是2400+系统经过的时间。要怎么写才对???

[解决办法]
Private Declare Function GetTickCount Lib "kernel32" () As Long

Public ite As Long

Private Sub Command1_Click()
ite = Val(Text2.Text)
ite = ite * 20 * 60 * 1000
Text1 = ite \ 1000
ite = ite + GetTickCount()
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Text2.Text = 2
Timer1.Enabled = False
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Dim tmp As Long

tmp = GetTickCount()
tmp = ite - tmp
If tmp <= 0 Then
Timer1.Enabled = False
Text1 = "0"
Else
Text1 = tmp \ 1000
End If
End Sub

读书人网 >VB

热点推荐