📄 机票信息.vb
字号:
Me.GroupBox2.Controls.Add(Me.Label6)
Me.GroupBox2.Location = New System.Drawing.Point(8, 184)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(480, 120)
Me.GroupBox2.TabIndex = 1
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "客户信息"
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(128, 32)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(120, 21)
Me.TextBox6.TabIndex = 7
Me.TextBox6.Text = ""
'
'Label13
'
Me.Label13.Location = New System.Drawing.Point(16, 32)
Me.Label13.Name = "Label13"
Me.Label13.Size = New System.Drawing.Size(72, 23)
Me.Label13.TabIndex = 6
Me.Label13.Text = "客户编号"
'
'ComboBox7
'
Me.ComboBox7.Location = New System.Drawing.Point(352, 80)
Me.ComboBox7.Name = "ComboBox7"
Me.ComboBox7.Size = New System.Drawing.Size(112, 20)
Me.ComboBox7.TabIndex = 5
'
'ComboBox6
'
Me.ComboBox6.Location = New System.Drawing.Point(352, 32)
Me.ComboBox6.Name = "ComboBox6"
Me.ComboBox6.Size = New System.Drawing.Size(112, 20)
Me.ComboBox6.TabIndex = 4
'
'ComboBox5
'
Me.ComboBox5.Location = New System.Drawing.Point(128, 80)
Me.ComboBox5.Name = "ComboBox5"
Me.ComboBox5.Size = New System.Drawing.Size(120, 20)
Me.ComboBox5.TabIndex = 3
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(256, 80)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(80, 23)
Me.Label8.TabIndex = 2
Me.Label8.Text = "折扣比例"
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(256, 32)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(80, 23)
Me.Label7.TabIndex = 1
Me.Label7.Text = "客户类型"
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(16, 80)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(88, 23)
Me.Label6.TabIndex = 0
Me.Label6.Text = "客户姓名"
'
'GroupBox3
'
Me.GroupBox3.Controls.Add(Me.TextBox2)
Me.GroupBox3.Controls.Add(Me.Label9)
Me.GroupBox3.Location = New System.Drawing.Point(8, 312)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(480, 80)
Me.GroupBox3.TabIndex = 2
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "GroupBox3"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(136, 8)
Me.TextBox2.Multiline = True
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.ScrollBars = System.Windows.Forms.ScrollBars.Both
Me.TextBox2.Size = New System.Drawing.Size(320, 64)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(16, 32)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(100, 24)
Me.Label9.TabIndex = 0
Me.Label9.Text = "备注信息"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(96, 408)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(112, 40)
Me.Button1.TabIndex = 3
Me.Button1.Text = "保存(&s)"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(280, 408)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(120, 40)
Me.Button2.TabIndex = 4
Me.Button2.Text = "返回(&x)"
'
'机票信息
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(496, 462)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "机票信息"
Me.Text = "机票信息"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox3.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()
If (mytemp = 0) Then
Button1.Text = "添加"
Else
Button1.Text = "修改"
End If
TextBox3.Focus()
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"))))
ComboBox4.Items.Add(Trim(CStr(my_class.dr("ticketprice"))))
ComboBox5.Items.Add(Trim(CStr(my_class.dr("customername"))))
ComboBox6.Items.Add(Trim(CStr(my_class.dr("customertype"))))
ComboBox7.Items.Add(Trim(CStr(my_class.dr("discount"))))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim con As String
Dim con1 As String
Dim tno, cno, ano As String
Dim cname, ct, dcity, acity, td, st, cm As String
Dim dc, tp, ts As Integer
Dim signe As Integer = 1
td = TextBox1.Text
cm = TextBox2.Text
tno = TextBox3.Text
ano = TextBox4.Text
ts = Val(TextBox5.Text)
cno = TextBox6.Text
dcity = ComboBox1.Text
acity = ComboBox2.Text
st = ComboBox3.Text
tp = Val(ComboBox4.Text)
cname = ComboBox5.Text
ct = ComboBox6.Text
dc = Val(ComboBox7.Text)
con = "select * from ticketinfo where ticketNO='" & TextBox3.Text & "'"
Dim ds As DataSet
Try
ds = my_class.query(con)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Try
If (ds.Tables(0).Rows.Count > 0 And mytemp = 0) Then
my_class.dr = ds.Tables(0).Rows(0)
If my_class.dr("ticketNO") > 0 Then
MsgBox("已存在该机票编号!")
TextBox3.Focus()
signe = 0
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
If TextBox3.Text = "" Then
MsgBox("机票编号不能为空!")
TextBox3.Focus()
ElseIf (signe = 1 Or mytemp = 1) Then
con1 = "delete from ticketinfo where ticketNO='" & TextBox3.Text & "'"
con = "insert into ticketinfo values('" & tno & "','" & cno & "','" & cname & "','" & ct & "','" & dc & "','" & ano & "','" & dcity & "','" & acity & "','" & td & "','" & st & "','" & tp & "','" & ts & "','" & cm & "')"
Try
my_class.delete(con1)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Try
my_class.update(con)
If (mytemp = 0) Then
MsgBox("订票成功!航班为" & TextBox1.Text & "从" & ComboBox1.Text & "到" & ComboBox2.Text & "的" & ComboBox3.Text & "机票,票价为" & ComboBox4.Text & "元")
End If
If (mytemp = 1) Then
MsgBox("修改成功!")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
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
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -