【VB开源代码栏目提醒】:网学会员鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“frmBookSeat.frm”一文,供大家参考学习
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form frmBookSeat
Caption = "预定座位"
ClientHeight = 5385
ClientLeft = 60
ClientTop = 450
ClientWidth = 7110
LinkTopic = "Form1"
ScaleHeight = 5385
ScaleWidth = 7110
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 3000
TabIndex = 2
Top = 4800
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确 定"
Height = 375
Left = 1440
TabIndex = 1
Top = 4800
Width = 855
End
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 4335
Left = 240
TabIndex = 0
Top = 240
Width = 6495
_ExtentX = 11456
_ExtentY = 7646
_Version = 393216
Cols = 6
FormatString = ""
End
End
Attribute VB_Name = "frmBookSeat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public sSQL As String
Private Sub Form_Load()
Dim txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim i, j, k, l, m As Integer
txtSQL = "select seatinfo.planeno,planeinfo.planetype,seatinfo.colseat,seatinfo.rowseat,seatinfo.lastseat from seatinfo inner join planeinfo on seatinfo.planeno = planeinfo.planeno inner join airlineinfo on airlineinfo.planeno = planeinfo.planeno where airlineinfo.airlineno = '" & sSQL & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
i = mrc.Fields(2)
j = mrc.Fields(3)
k = mrc.Fields(4)
msgList.FixedCols = 1
msgList.Rows = 1
msgList.Cols = i + 1
For l = 1 To i
msgList.TextMatrix(0, l) = Chr(64 + l)
Next l
With msgList
For m = 1 To j
.Rows = .Rows + 1
.TextMatrix(m, 0) = m
For l = 1 To i
.TextMatrix(m, l) = m & Chr(64 + l)
Next l
Next m
End With
mrc.Close
txtSQL = "select colseat,rowseat from ticketinfo "
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Do While Not mrc.EOF
msgList.TextMatrix(CInt(Trim(mrc.Fields(1))), CInt(Trim(mrc.Fields(0)))) = "★"
mrc.MoveNext
Loop
mrc.Close
End If
End If
End Sub
Private Sub Form_Resize()
msgList.Left = Me.ScaleLeft + 100
msgList.Width = Me.ScaleWidth - 200
msgList.Top = Me.ScaleTop + 100
msgList.Height = Me.ScaleHeight - 800
Command1.Top = msgList.Top + msgList.Height + 200
Command2.Top = Command1.Top
Command1.Left = Me.ScaleWidth / 2 - 1000
Command2.Left = Command1.Left + 1000
End Sub
Private Sub msgList_Click()
Dim intRow As Integer
Dim intCol As Integer
intRow = msgList.Row
intCol = msgList.Col
If msgList.Rows > 1 Then
If Trim(msgList.TextMatrix(intRow, intCol)) = "★" Then
MsgBox intRow & "行" & intCol & "列的座位已经被预订,请重新选择!", vbOKOnly, "预定座位"
Else
If MsgBox("确定选择" & intRow & "行" & intCol & "列的座位吗?", vbOKCancel, "预定座位") = vbOK Then
msgList.TextMatrix(intRow, intCol) = "★"
End If
End If
End If
End Sub
上一篇:
FrmBooks.frm
下一篇:
扛起年轻化大旗,哈弗F系玩转行业新风潮