<プログラム> Dim BeforeTime As Long Dim NowTime As Long Dim n As Integer 'システムを立ち上げてからの経過時間(単位:ミリ秒)を取得 Private Declare Function GetTickCount Lib "Kernel32" () As Long '実行処理 Private Sub buttonRun_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles buttonRun.Click For n = 1 To 20 TimeCheck() Next End Sub 'データ取得&表示 Private Sub TimeCheck() BeforeTime = GetTickCount TextBox1.Text = TextBox1.Text & n & " : " & BeforeTime & " " & BeforeTime - NowTime & ControlChars.CrLf NowTime = BeforeTime End Sub
Long型をIntegser型にするとうまくいきました。
Private Declare Function GetTickCount Lib "Kernel32" () As Long
↓
Private Declare Function GetTickCount Lib "Kernel32" () As Integer
とすることで問題解決しました。