📄 机票信息查询.vb
字号:
Public Class 机票信息查询
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.ComboBox3 = New System.Windows.Forms.ComboBox
Me.ComboBox2 = New System.Windows.Forms.ComboBox
Me.ComboBox1 = New System.Windows.Forms.ComboBox
Me.Label3 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Label4)
Me.GroupBox1.Controls.Add(Me.Label2)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.TextBox1)
Me.GroupBox1.Controls.Add(Me.ComboBox3)
Me.GroupBox1.Controls.Add(Me.ComboBox2)
Me.GroupBox1.Controls.Add(Me.ComboBox1)
Me.GroupBox1.Controls.Add(Me.Label3)
Me.GroupBox1.Location = New System.Drawing.Point(16, 24)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(560, 128)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "航线信息"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(144, 88)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 21)
Me.TextBox1.TabIndex = 7
Me.TextBox1.Text = ""
'
'ComboBox3
'
Me.ComboBox3.Location = New System.Drawing.Point(432, 88)
Me.ComboBox3.Name = "ComboBox3"
Me.ComboBox3.Size = New System.Drawing.Size(121, 20)
Me.ComboBox3.TabIndex = 6
'
'ComboBox2
'
Me.ComboBox2.Location = New System.Drawing.Point(432, 32)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(121, 20)
Me.ComboBox2.TabIndex = 5
'
'ComboBox1
'
Me.ComboBox1.Location = New System.Drawing.Point(144, 32)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(121, 20)
Me.ComboBox1.TabIndex = 4
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(48, 88)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 23)
Me.Label3.TabIndex = 2
Me.Label3.Text = "出发时间"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(64, 176)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(120, 40)
Me.Button1.TabIndex = 1
Me.Button1.Text = "确定(&o)"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(248, 176)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(120, 40)
Me.Button2.TabIndex = 2
Me.Button2.Text = "取消(&x)"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(424, 176)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(120, 40)
Me.Button3.TabIndex = 9
Me.Button3.Text = "重新查询 "
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(48, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 23)
Me.Label1.TabIndex = 11
Me.Label1.Text = "出发城市"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(336, 32)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 23)
Me.Label2.TabIndex = 12
Me.Label2.Text = "到达城市 "
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(336, 88)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(72, 23)
Me.Label4.TabIndex = 13
Me.Label4.Text = "舱位类型"
'
'机票信息查询
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(624, 246)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "机票信息查询"
Me.Text = "机票信息查询"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub 机票信息查询_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ct = 61
my_class.init()
Dim ds As DataSet
Dim con As String
Dim count, i As Integer
con = "select * from ticketinfo"
ds = my_class.query(con)
count = ds.Tables(0).Rows.Count
For i = 0 To count - 1
my_class.dr = ds.Tables(0).Rows(i)
ComboBox1.Items.Add(Trim(CStr(my_class.dr("departcity"))))
ComboBox2.Items.Add(Trim(CStr(my_class.dr("arrivalcity"))))
ComboBox3.Items.Add(Trim(CStr(my_class.dr("servicetype"))))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ds As DataSet
Dim con, con1, con2, con3, con4 As String
Dim str1, str2, str3, str4 As String
Dim x, x1, x2, x3, x4, i As Integer
str1 = ComboBox1.Text
str2 = ComboBox2.Text
str3 = ComboBox3.Text
str4 = TextBox1.Text
If (str1 = "" Or str2 = "" Or str3 = "" Or str4 = "") Then
MessageBox.Show("请完成选择!", "提示")
ElseIf (str1 = str2) Then
MsgBox("出发地与目的地不能为同一地点! 请重新选择!")
Else
con = "select * from ticketinfo where departcity='" + str1 + "'and arrivalcity='" + str2 + "' and servicetype='" + str3 + "' and ticketdate='" + str4 + "'"
con1 = "select * from ticketinfo where departcity='" + str1 + "'"
con2 = "select * from ticketinfo where arrivalcity='" + str2 + "'"
con3 = "select * from ticketinfo where servicetype='" + str3 + "'"
con4 = "select * from ticketinfo where ticketdate='" + str4 + "'"
ds = my_class.query(con)
x = ds.Tables(0).Rows.Count
ds = my_class.query(con1)
x1 = ds.Tables(0).Rows.Count
ds = my_class.query(con2)
x2 = ds.Tables(0).Rows.Count
ds = my_class.query(con3)
x3 = ds.Tables(0).Rows.Count
ds = my_class.query(con4)
x4 = ds.Tables(0).Rows.Count
If (x > 0) Then
my_class.dr = ds.Tables(0).Rows(0)
MsgBox("还有" & TextBox1.Text & "从" & ComboBox1.Text & "到" & ComboBox2.Text & "的" & ComboBox3.Text & "机票!!")
ElseIf (x1 <= 0) Then
MsgBox("没有该出发城市!")
ComboBox1.SelectAll()
ElseIf (x2 <= 0) Then
MsgBox("没有该到达城市!")
ComboBox2.SelectAll()
ElseIf (x3 <= 0) Then
MsgBox("没有该客机类型!")
ComboBox3.SelectAll()
ElseIf (x4 <= 0) Then
MsgBox("没有该出发时间!")
TextBox1.Focus()
TextBox1.SelectAll()
Else
MsgBox("没有" & TextBox1.Text & "从" & ComboBox1.Text & "到" & ComboBox2.Text & "的" & ComboBox3.Text & "机票!!")
End If
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox1.Items.Clear()
ComboBox2.Items.Clear()
ComboBox3.Items.Clear()
TextBox1.Text = ""
Dim ds As DataSet
Dim con As String
Dim count, i As Integer
con = "select * from ticketinfo"
ds = my_class.query(con)
count = ds.Tables(0).Rows.Count
For i = 0 To count - 1
my_class.dr = ds.Tables(0).Rows(i)
ComboBox1.Items.Add(Trim(CStr(my_class.dr("departcity"))))
ComboBox2.Items.Add(Trim(CStr(my_class.dr("arrivalcity"))))
ComboBox3.Items.Add(Trim(CStr(my_class.dr("servicetype"))))
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
Private Sub 机票信息查询_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
Dim mdifrm As New MDIForm1
mdifrm = Me.MdiParent
mdifrm.StatusBar1.Panels(0).Text = Me.Text
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -