📄 frmifthe.frm
字号:
VERSION 5.00
Begin VB.Form frmIfThen
Caption = "Fig. 3.18: Testing the comparison operators"
ClientHeight = 4365
ClientLeft = 2250
ClientTop = 1725
ClientWidth = 5205
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 4365
ScaleWidth = 5205
Begin VB.CommandButton cmdEnterNumbers
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Enter Numbers"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 435
TabIndex = 0
Top = 3405
Width = 2175
End
Begin VB.CommandButton cmdExit
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Exit"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 3345
TabIndex = 1
Top = 3420
Width = 1455
End
Begin VB.Label lblDisplay4
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 420
TabIndex = 5
Top = 2670
Width = 4320
End
Begin VB.Label lblDisplay3
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 4
Top = 1920
Width = 4320
End
Begin VB.Label lblDisplay2
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 3
Top = 1080
Width = 4215
End
Begin VB.Label lblDisplay1
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 2
Top = 240
Width = 4215
End
End
Attribute VB_Name = "frmIfThen"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Code listing for Fig. 3.18
' Program compares two numbers
Option Explicit ' Force explicit declarations
Private Sub cmdEnterNumbers_Click()
Dim num1 As Integer, num2 As Integer
' Clear Labels
lblDisplay1.Caption = ""
lblDisplay2.Caption = ""
lblDisplay3.Caption = ""
lblDisplay4.Caption = ""
' Get values from user
num1 = InputBox("Enter first integer", "Input")
num2 = InputBox("Enter second integer", "Input")
' Test the relationships between the numbers
If num1 = num2 Then
lblDisplay1.Caption = num1 & " is equal to " & num2
End If
If num1 <> num2 Then
lblDisplay1.Caption = num1 & " is not equal to " & num2
End If
If num1 > num2 Then
lblDisplay2.Caption = num1 & " is greater than " & num2
End If
If num1 < num2 Then
lblDisplay2.Caption = num1 & " is less than " & num2
End If
If num1 >= num2 Then
lblDisplay3.Caption = num1 & _
" is greater than or equal to " _
& num2
End If
If num1 <= num2 Then
lblDisplay4.Caption = num1 & _
" is less than or equal to " & num2
End If
End Sub
Private Sub cmdExit_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -