Public Class Form1
Public Structure ReadDateType
Public Data As Double
Public ReadDate As Date
End Structure
Dim A As Double = 0
Dim B As Double = 0
Dim C() As ReadDateType
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim U As Integer
ReDim C(0)
A = ReadData() '你读到的数
U = UBound(C) + 1
ReDim Preserve C(U)
C(U).Data = A
C(U).ReadDate = Now()
If A <> B Then
A = B
UpdateData() '上传数据
ReDim C(0) '清除数据
End If
End Sub
End Class