Private Sub Form_Load() Timer2.Interval = 1 End Sub Private Sub Timer2_Timer() Dim a(10) As Integer Timer2.Interval = Timer2.Interval + 1 If Timer2.Interval = 20 Then i = 1 Do While i < 10 If i = 10 Then Exit Do Else i = i + 1 End If a(i) = Abs(i - 15) / 2 Min = a(1) For i = 1 To 10 If Min > a(i) Then Min = a(i) End If Next i Print Min Loop End If End Sub
i can find min and max in this case
Private Sub Command1_Click() A(1) = 5 A(2) = 34 A(3) = 2 A(4) = 1 A(5) = 100 A(6) = 8 i_min = LBound(A) i_max = UBound(A) max = 0 For i = i_min To i_max If A(i) > max Then max = A(i) Print A(i) Next Print min Text1.Text = max Text2.Text = min End Subit is shown in text1=100 and text2=1, it works fine, but when i am trying with timer it does not work


Sign In
Create Account

Back to top









