【VB开源代码栏目提醒】:网学会员VB开源代码为您提供Ex5_9.frm参考,解决您在Ex5_9.frm学习中工作中的难题,参考学习。
VERSION 5.00
Begin VB.Form Ex5_9
Caption = "Form1"
ClientHeight = 3390
ClientLeft = 60
ClientTop = 450
ClientWidth = 3570
LinkTopic = "Form1"
ScaleHeight = 3390
ScaleWidth = 3570
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command
Caption = "省略两个参数"
Height = 375
Index = 2
Left = 480
TabIndex = 6
Top = 2640
Width = 2415
End
Begin VB.CommandButton Command
Caption = "省略第二个参数"
Height = 375
Index = 1
Left = 480
TabIndex = 5
Top = 2040
Width = 2415
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 4
Top = 840
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 3
Top = 240
Width = 1695
End
Begin VB.CommandButton Command
Caption = "省略第一个参数"
Height = 375
Index = 0
Left = 480
TabIndex = 0
Top = 1440
Width = 2415
End
Begin VB.Label Label1
Caption = "第一个参数"
Height = 255
Left = 360
TabIndex = 2
Top = 240
Width = 975
End
Begin VB.Label Label2
Caption = "第二个参数"
Height = 255
Left = 360
TabIndex = 1
Top = 840
Width = 975
End
End
Attribute VB_Name = "Ex5_9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub mysub(Optional var1 As Integer, Optional var2 As Variant)
If IsMissing(var1) Then '判断第一个参数是否被省略
Text1.Text = "第一个参数被省略"
Else
Text1.Text = var1
End If
If IsMissing(var2) Then '判断第二个参数是否被省略
Text2.Text = "第二个参数被省略"
Else
Text2.Text = var2
End If
End Sub
Private Sub Command_Click(Index As Integer)
Select Case Index
Case 0 '单击第一个按钮
Call mysub(, 10)
Case 1 '单击第二个按钮
Call mysub(18)
Case 2 '单击第三个按钮
Call mysub
End Select
End Sub
上一篇:
Ex5_8_2.frm
下一篇:
投简历到国外的公司需考虑哪些东西?