📄 frmplaneedit.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 3840
TabIndex = 24
Top = 1200
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "起飞时间"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 23
Top = 1207
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "抵达机场"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 3840
TabIndex = 22
Top = 765
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "起飞机场"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 21
Top = 765
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "航空公司"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 20
Top = 315
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "折扣票价"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 3840
TabIndex = 19
Top = 2100
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "公布票价"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 18
Top = 2100
Width = 720
End
End
End
Attribute VB_Name = "FrmPlaneEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriId As Long
Public OriPno, OriSairport, OriEairport, OriCycle As String
Private Sub Cmd_OK_Click()
Dim TmpCycle As String
'检查用户输入数据的有效性
If Trim(txtAirCom) = "" Then
MsgBox "请输入航空公司"
txtAirCom.SetFocus
Exit Sub
End If
If Trim(txtSairport) = "" Then
MsgBox "请输入起飞机场"
txtSairport.SetFocus
Exit Sub
End If
If Trim(txtEairport) = "" Then
MsgBox "请输入抵达机场"
txtEairport.SetFocus
Exit Sub
End If
'把用户输入的数据赋值到MyPlane对象的成员变量中
With MyPlane
.AirCom = MakeStr(txtAirCom)
.Pno = MakeStr(txtPno)
.Sairport = MakeStr(txtSairport)
.Eairport = MakeStr(txtEairport)
.Stime = MakeStr(txtStime)
.Etime = MakeStr(txtEtime)
.Price1 = Val(txtPrice1)
.Price2 = Val(txtPrice2)
'TmpCycle用来保存飞机的航班周期字符串
TmpCycle = ""
If Check1.Value = 1 Then
TmpCycle = TmpCycle + "1"
End If
If Check2.Value = 1 Then
TmpCycle = TmpCycle + "2"
End If
If Check3.Value = 1 Then
TmpCycle = TmpCycle + "3"
End If
If Check4.Value = 1 Then
TmpCycle = TmpCycle + "4"
End If
If Check5.Value = 1 Then
TmpCycle = TmpCycle + "5"
End If
If Check6.Value = 1 Then
TmpCycle = TmpCycle + "6"
End If
If Check7.Value = 1 Then
TmpCycle = TmpCycle + "7"
End If
MyPlane.Cycle = TmpCycle
'判断飞机信息是否已经在数据库中存在
If Modify = False Or OriPno <> Trim(txtPno) Or _
OriSairport <> Trim(txtSairport) Or OriEairport <> Trim(txtEairport) Then
If .In_DB(MakeStr(txtPno), MakeStr(txtSairport), MakeStr(txtEairport)) = True Then
MsgBox "当前数据已经存在,请重新输入"
txtPno.SetFocus
txtPno.SelStart = 0
txtPno.SelLength = Len(txtPno)
Exit Sub
End If
End If
'根据变量Modify决定是插入数据,还是修改数据
If Modify = False Then
.Insert
Else
.Update (OriId)
End If
End With
'关闭窗体
Unload Me
End Sub
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim TmpCycle As Integer
'将航班周期字符串折分单个字符,并保存在变量TmpCycle中
'然后根据变量TmpCycle的值,决定航班周期的显示
Do While OriCycle <> ""
TmpCycle = Val(Left(OriCycle, 1))
OriCycle = Right(OriCycle, Len(OriCycle) - 1)
Select Case TmpCycle
Case 1
Check1.Value = 1
Case 2
Check2.Value = 1
Case 3
Check3.Value = 1
Case 4
Check4.Value = 1
Case 5
Check5.Value = 1
Case 6
Check6.Value = 1
Case 7
Check7.Value = 1
End Select
Loop
End Sub
Private Sub txtEairport_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtEtime_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPrice1_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtPrice2_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
Private Sub txtSairport_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtStime_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
Private Sub txtPno_KeyPress(KeyAscii As Integer)
EnterTAB (KeyAscii)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -