Option ExplicitPrivate Sub Command1_Click() Dim n(7) As Double Dim k(3) As Double k(3) = 1 Dim j As Integer For j = 1 To 7 n(j) = Val(Controls("Text" & CStr(j)).Text) Next j For j = 1 To 7 k(1) = k(1) + n(j) k(2) = k(2) - n(j) k(3) = k(3) * n(j) Next j Me.Text8.Text = "7個數的和為:" & k(1) & vbCrLf & _ "7個數的差為:" & k(2) & vbCrLf & _ "7個數的乘積為:" & k(3)End SubPrivate Sub Command2_Click() Dim i As Integer For i = 1 To 8 Controls("Text" & CStr(i)).Text = "" Next iEnd SubPrivate Sub Form_Load() Dim i As Integer For i = 1 To 8 Controls("Text" & CStr(i)).Text = "" Next iEnd Sub
Option ExplicitPrivate Sub Command1_Click() Dim n(7) As Double Dim k(3) As Double k(3) = 1 Dim j As Integer For j = 1 To 7 n(j) = Val(Controls("Text" & CStr(j)).Text) Next j For j = 1 To 7 k(1) = k(1) + n(j) k(2) = k(2) - n(j) k(3) = k(3) * n(j) Next j Me.Text8.Text = "7個數的和為:" & k(1) & vbCrLf & _ "7個數的差為:" & k(2) & vbCrLf & _ "7個數的乘積為:" & k(3)End SubPrivate Sub Command2_Click() Dim i As Integer For i = 1 To 8 Controls("Text" & CStr(i)).Text = "" Next iEnd SubPrivate Sub Form_Load() Dim i As Integer For i = 1 To 8 Controls("Text" & CStr(i)).Text = "" Next iEnd Sub