📄 第7章编程第1题.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2160
ClientLeft = 60
ClientTop = 345
ClientWidth = 5415
LinkTopic = "Form1"
ScaleHeight = 2160
ScaleWidth = 5415
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3720
TabIndex = 4
Text = " "
Top = 1440
Width = 975
End
Begin VB.CommandButton Command1
Caption = "检验"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3720
TabIndex = 3
Top = 480
Width = 975
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 2
Text = " "
Top = 1440
Width = 975
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 1
Text = " "
Top = 840
Width = 975
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 0
Text = " "
Top = 240
Width = 975
End
Begin VB.Label Label4
Caption = "结果"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3240
TabIndex = 8
Top = 1560
Width = 615
End
Begin VB.Label Label3
Caption = "文本框3"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 7
Top = 1560
Width = 855
End
Begin VB.Label Label2
Caption = "文本框2"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 6
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "文本框1"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 5
Top = 360
Width = 855
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()
Dim a As String, b As String, c As String
a = Trim(Text1.Text)
b = Trim(Text2.Text)
c = Trim(Text3.Text)
If che(a) And che(b) And che(c) Then
Text4.Text = Val(a) + Val(b) + Val(c)
Else
Text4.Text = "存在非数字字符"
End If
End Sub
Function che(x As String) As Boolean
che = True
For k = 1 To Len(x)
s = Mid(x, k, 1)
If s < "0" Or s > "9" Then
che = False
Exit For
End If
Next k
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -