📄 客机信息查询.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
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 ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ComboBox1 = New System.Windows.Forms.ComboBox
Me.ComboBox2 = New System.Windows.Forms.ComboBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.SuspendLayout()
'
'ComboBox1
'
Me.ComboBox1.Location = New System.Drawing.Point(192, 32)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(160, 20)
Me.ComboBox1.TabIndex = 2
'
'ComboBox2
'
Me.ComboBox2.Location = New System.Drawing.Point(192, 112)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(160, 20)
Me.ComboBox2.TabIndex = 3
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(40, 176)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(120, 32)
Me.Button1.TabIndex = 4
Me.Button1.Text = "确定(&o)"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(232, 176)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(128, 32)
Me.Button2.TabIndex = 5
Me.Button2.Text = "取消(&x)"
'
'RadioButton1
'
Me.RadioButton1.Checked = True
Me.RadioButton1.Location = New System.Drawing.Point(48, 32)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.TabIndex = 6
Me.RadioButton1.TabStop = True
Me.RadioButton1.Text = "客机编号"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(48, 112)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.TabIndex = 7
Me.RadioButton2.Text = "客机类型"
'
'客机信息查询
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(456, 238)
Me.Controls.Add(Me.RadioButton2)
Me.Controls.Add(Me.RadioButton1)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ComboBox2)
Me.Controls.Add(Me.ComboBox1)
Me.Name = "客机信息查询"
Me.Text = "客机信息查询"
Me.ResumeLayout(False)
End Sub
#End Region
Dim my_class As New class1
Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ct = 21
my_class.init()
Dim ds As DataSet
Dim con As String
Dim count, i As Integer
con = "select * from planeinfo"
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(CStr(my_class.dr(0)))
ComboBox2.Items.Add(CStr(my_class.dr(1)))
Next
If RadioButton1.Checked = True Then
ComboBox2.Enabled = False
ElseIf RadioButton2.Checked = True Then
ComboBox1.Enabled = False
End If
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 As String
Dim str As String
Dim count As Integer
If RadioButton1.Checked = True Then
ComboBox2.Text = ""
str = ComboBox1.Text
con = "select * from planeinfo where planeno='" + str + "'"
ds = my_class.query(con)
count = ds.Tables(0).Rows.Count
If (count > 0 And ComboBox1.Text <> "") Then
my_class.dr = ds.Tables(0).Rows(0)
ComboBox2.Text = CStr(my_class.dr("planetype"))
Else
MsgBox("客机编号选择有误,请重新选择!")
ComboBox1.SelectAll()
ComboBox2.Text = ""
End If
ElseIf RadioButton2.Checked = True Then
ComboBox1.Text = ""
str = ComboBox2.Text
con = "select * from planeinfo where planetype='" + str + "'"
ds = my_class.query(con)
count = ds.Tables(0).Rows.Count
If (count > 0 And ComboBox2.Text <> "") Then
my_class.dr = ds.Tables(0).Rows(0)
ComboBox1.Text = CStr(my_class.dr("planeno"))
Else
MsgBox("客机类型选择有误,请重新选择!")
ComboBox2.SelectAll()
ComboBox1.Text = ""
End If
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 RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
ComboBox1.Enabled = True
ComboBox2.Enabled = False
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
If RadioButton2.Checked = True Then
ComboBox1.Enabled = False
ComboBox2.Enabled = True
End If
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 + -