【VB开源代码栏目提醒】:以下是网学会员为您推荐的VB开源代码-Ex5_13.frm,希望本篇文章对您学习有所帮助。
VERSION 5.00
Begin VB.Form Ex5_13
Caption = "Form1"
ClientHeight = 2925
ClientLeft = 60
ClientTop = 450
ClientWidth = 3645
LinkTopic = "Form1"
ScaleHeight = 2925
ScaleWidth = 3645
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "计算"
Height = 375
Left = 360
TabIndex = 9
Top = 2160
Width = 855
End
Begin VB.TextBox Text4
Height = 375
Left = 2160
TabIndex = 8
Top = 1560
Width = 975
End
Begin VB.TextBox Text3
Height = 375
Left = 720
TabIndex = 6
Top = 1560
Width = 975
End
Begin VB.TextBox Text2
Height = 375
Left = 2160
TabIndex = 4
Top = 960
Width = 975
End
Begin VB.TextBox Text1
Height = 375
Left = 720
TabIndex = 2
Top = 960
Width = 975
End
Begin VB.Label Label6
Height = 255
Left = 1440
TabIndex = 10
Top = 2280
Width = 1695
End
Begin VB.Label Label5
Caption = "d="
Height = 255
Left = 1800
TabIndex = 7
Top = 1680
Width = 255
End
Begin VB.Label Label4
Caption = "c="
Height = 255
Left = 360
TabIndex = 5
Top = 1680
Width = 255
End
Begin VB.Label Label3
Caption = "b="
Height = 255
Left = 1800
TabIndex = 3
Top = 1080
Width = 255
End
Begin VB.Label Label2
Caption = "a="
Height = 255
Left = 360
TabIndex = 1
Top = 1080
Width = 255
End
Begin VB.Label Label1
Caption = "计算(a+b)*(c+d)的值"
Height = 255
Left = 600
TabIndex = 0
Top = 360
Width = 2175
End
End
Attribute VB_Name = "Ex5_13"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Function Sum(a As Integer, b As Integer) As Integer
Sum = a + b
End Function
Public Function mul(c As Integer, d As Integer) As Integer
mul = c * d
End Function
Public Function GetValue(a As Integer, b As Integer, c As Integer, d As Integer) As Integer
'在函数内部调用了函数ji,同时参数中又调用了函数sum
GetValue = mul(Sum(a, b), Sum(c, d))
End Function
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer
a = Text1.Text
b = Text2.Text
c = Text3.Text
d = Text4.Text
Label6.Caption = "(a+b)*(c+d)=" & GetValue(a, b, c, d)
End Sub
上一篇:
Ex5_12.frm
下一篇:
发表一篇论文需要多少费用?