首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

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

2012-06-27 
请教老师这句问题出在哪里???VB codePrivate Declare Function GetTickCount Lib kernel32 () As LongPu

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

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

热点排行