# 这个不会很难啊???

Posted by 笋子 on March 14, 1999 at 15:47:59:

In Reply to: 请问................... posted by 阿远 on March 13, 1999 at 21:15:01:

: 的算数程式
: 算式及解都能显现在表单上
: 那我该如何去做????
从 1+2+3... 和阶层都适用....
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2820
ClientLeft = 60
ClientTop = 345
ClientWidth = 6045
LinkTopic = "Form1"
ScaleHeight = 2820
ScaleWidth = 6045
StartUpPosition = 3 '系统预设值
Begin VB.CommandButton Command2
Caption = "计算结果"
Height = 375
Left = 1440
TabIndex = 6
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "计算结果"
Height = 375
Left = 120
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.TextBox Text3
Height = 1335
Left = 120
TabIndex = 4
Top = 720
Width = 5655
End
Begin VB.TextBox Text2
Height = 495
Left = 3360
TabIndex = 1
Text = "10"
Top = 120
Width = 1935
End
Begin VB.TextBox Text1
Height = 495
Left = 840
TabIndex = 0
Text = "1"
Top = 120
Width = 1695
End
Begin VB.Label Label2
Caption = "结束值"
Height = 255
Left = 2640
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.Label Label1
Caption = "起始值"
Height = 255
Left = 0
TabIndex = 2
Top = 240
Width = 615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1 <> "" And Text2 <> "" Then
If IsNumeric(Text1) And IsNumeric(Text2) Then
For i = Text1 To Text2
Total = Total + (i)
Next i
Text3 = Total
End If
End If
End Sub

Private Sub Command2_Click()
If Text1 <> "" And Text2 <> "" Then
If IsNumeric(Text1) And IsNumeric(Text2) Then
Total = ((Int(Text1) + Int(Text2)) * (Int(Text2) - Int(Text1) + 1)) / 2
Text3 = Total
End If
End If
End Sub

Follow Ups:

- Re: 有疑问?????&谢谢!! 阿远 23:24:36 3/15/99 (1)
  - 懒的再改了 笋子 15:38:19 3/16/99 (0)