📄 frmservice1.frm
字号:
VERSION 5.00
Begin VB.Form frmService1
BorderStyle = 3 'Fixed Dialog
Caption = "舱位等级信息"
ClientHeight = 4080
ClientLeft = 45
ClientTop = 330
ClientWidth = 6780
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4080
ScaleWidth = 6780
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Caption = "舱位等级:"
Height = 3015
Left = 120
TabIndex = 4
Top = 120
Width = 6495
Begin VB.TextBox txtItem
Height = 600
Index = 2
Left = 1680
MaxLength = 50
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 23
Top = 2160
Width = 4575
End
Begin VB.ComboBox Combo1
Height = 300
Index = 7
Left = 5040
Style = 2 'Dropdown List
TabIndex = 18
Top = 1800
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 6
Left = 1680
Style = 2 'Dropdown List
TabIndex = 17
Top = 1800
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 5
Left = 5040
Style = 2 'Dropdown List
TabIndex = 16
Top = 1440
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 4
Left = 1680
Style = 2 'Dropdown List
TabIndex = 15
Top = 1440
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 3
Left = 5040
Style = 2 'Dropdown List
TabIndex = 13
Top = 1080
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 2
Left = 1680
Style = 2 'Dropdown List
TabIndex = 12
Top = 1080
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 1
Left = 5040
Style = 2 'Dropdown List
TabIndex = 11
Top = 720
Width = 1212
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
ItemData = "frmService1.frx":0000
Left = 1680
List = "frmService1.frx":0002
Style = 2 'Dropdown List
TabIndex = 10
Top = 720
Width = 1212
End
Begin VB.TextBox txtItem
Height = 270
Index = 0
Left = 1680
MaxLength = 8
TabIndex = 0
Top = 360
Width = 1212
End
Begin VB.TextBox txtItem
Height = 270
Index = 1
Left = 5040
MaxLength = 20
TabIndex = 1
Top = 360
Width = 1212
End
Begin VB.Label Label2
Caption = "备注信息:"
Height = 255
Index = 10
Left = 360
TabIndex = 24
Top = 2160
Width = 1695
End
Begin VB.Label Label2
Caption = "是否可以打折:"
Height = 255
Index = 9
Left = 3480
TabIndex = 22
Top = 1800
Width = 1335
End
Begin VB.Label Label2
Caption = "是否可以退票:"
Height = 255
Index = 4
Left = 360
TabIndex = 21
Top = 1800
Width = 1455
End
Begin VB.Label Label2
Caption = "是否可以改签:"
Height = 255
Index = 3
Left = 3480
TabIndex = 20
Top = 1440
Width = 1335
End
Begin VB.Label Label2
Caption = "是否有电影:"
Height = 252
Index = 2
Left = 360
TabIndex = 19
Top = 1440
Width = 1092
End
Begin VB.Label Label2
Caption = "是否有午餐:"
Height = 255
Index = 8
Left = 3480
TabIndex = 14
Top = 1080
Width = 1095
End
Begin VB.Label Label2
Caption = "是否有饮料:"
Height = 252
Index = 7
Left = 360
TabIndex = 9
Top = 1080
Width = 1092
End
Begin VB.Label Label2
Caption = "是否有报纸:"
Height = 255
Index = 6
Left = 3480
TabIndex = 8
Top = 720
Width = 1335
End
Begin VB.Label Label2
Caption = "是否有礼品:"
Height = 252
Index = 5
Left = 360
TabIndex = 7
Top = 720
Width = 1092
End
Begin VB.Label Label2
Caption = "舱位等级编号:"
Height = 255
Index = 0
Left = 360
TabIndex = 6
Top = 360
Width = 1335
End
Begin VB.Label Label2
Caption = "舱位等级名称:"
Height = 255
Index = 1
Left = 3480
TabIndex = 5
Top = 360
Width = 1335
End
End
Begin VB.CommandButton cmdExit
Caption = "返回 (&X)"
Height = 375
Left = 3360
TabIndex = 3
Top = 3480
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "保存 (&S)"
Height = 375
Left = 1800
TabIndex = 2
Top = 3480
Width = 1215
End
End
Attribute VB_Name = "frmService1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'是否改动过记录,ture为改过
Dim mblChange As Boolean
Dim mrc As ADODB.Recordset
Public txtSQL As String
Private Sub cmdExit_Click()
If mblChange And cmdSave.Enabled Then
If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
'保存
Call cmdSave_Click
End If
End If
Unload Me
End Sub
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim sMeg As String
Dim MsgText As String
For intCount = 0 To 1
If Trim(txtItem(intCount) & " ") = "" Then
Select Case intCount
Case 0
sMeg = "机舱等级编号"
Case 1
sMeg = "机舱等级名称"
End Select
sMeg = sMeg & "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(intCount).SetFocus
Exit Sub
End If
Next intCount
If Not IsNumeric(Trim(txtItem(0))) Then
sMeg = "机舱等级编号"
sMeg = sMeg & "请输入数字!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(0).SetFocus
End If
Dim txtString(9) As String
For intCount = 0 To 1
mrc.Fields(intCount) = txtString(intCount)
Next intCount
For intCount = 0 To 7
mrc.Fields(intCount + 2) = txtString(intCount)
Next intCount
objPlane.Save txtString()
If gintSmode = 1 Then
MsgBox "添加记录成功!", vbOKOnly + vbExclamation, "添加记录"
For intCount = 0 To 1
txtItem(intCount) = ""
Next intCount
For intCount = 0 To 3
Combo1(intCount).ListIndex = 0
Next intCount
txtItem(2) = ""
mblChange = False
Unload frmService
frmService.txtSQL = "select * from serviceInfo"
frmService.Show
ElseIf gintSmode = 2 Then
Unload Me
Unload frmService
frmService.txtSQL = "select * from serviceInfo"
frmService.Show
End If
End Sub
Private Sub Form_Load()
Dim intCount As Integer
Dim MsgText As String
Dim i As Integer
If gintSmode = 1 Then
Me.Caption = Me.Caption & "添加"
For i = 0 To 7
Combo1(i).AddItem "否"
Combo1(i).AddItem "是"
Combo1(i).ListIndex = 0
Next i
ElseIf gintSmode = 2 Then
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With mrc
For intCount = 0 To 1
txtItem(intCount) = .Fields(intCount)
Next intCount
txtItem(2) = .Fields(10)
For i = 0 To 7
Combo1(i).AddItem "否"
Combo1(i).AddItem "是"
Combo1(i).ListIndex = 0
Next i
End With
txtItem(0).Enabled = False
End If
Me.Caption = Me.Caption & "修改"
End If
mblChange = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
gintSmode = 0
End Sub
Private Sub txtItem_Change(Index As Integer)
'有变化设置gblchange
mblChange = True
End Sub
Private Sub txtItem_GotFocus(Index As Integer)
txtItem(Index).SelStart = 0
txtItem(Index).SelLength = Len(txtItem(Index))
End Sub
Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -