楼主您好!
代码如下:
Option Explicit
Private 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 Sub
Private Sub Command2_Click()
Dim i As Integer
For i = 1 To 8
Controls("Text" & CStr(i)).Text = ""
Next i
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 8
Controls("Text" & CStr(i)).Text = ""
Next i
End Sub
Private Sub Command1_Click()
Text8 = Str(Val(Text1) + Val(Text2) + Val(Text3) + Val(Text4) + Val(Text5) + Val(Text6) + Val(Text7))
End Sub
Private Sub Command2_Click()
Text1 = "": Text2 = "": Text3 = "": Text4 = "": Text5 = "": Text6 = "": Text7 = "": Text8 = "":
End Sub
Private Sub Form_Load()
Command1.Caption = "计算"
Command2.Caption = "清空"
Text1 = "": Text2 = "": Text3 = "": Text4 = "": Text5 = "": Text6 = "": Text7 = "": Text8 = "":
End Sub