📄 frm_zongjingli_gongchengcailiao_chaxun.vb
字号:
Public Class Frm_zongjingli_gongchengcailiao_chaxun
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 TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
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 DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox
Friend WithEvents ComboBox4 As System.Windows.Forms.ComboBox
Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton
Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.RadioButton2 = New System.Windows.Forms.RadioButton
Me.RadioButton1 = New System.Windows.Forms.RadioButton
Me.ComboBox4 = New System.Windows.Forms.ComboBox
Me.ComboBox3 = New System.Windows.Forms.ComboBox
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.Button1 = New System.Windows.Forms.Button
Me.ComboBox2 = New System.Windows.Forms.ComboBox
Me.ComboBox1 = New System.Windows.Forms.ComboBox
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'TabControl1
'
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.TabControl1.Location = New System.Drawing.Point(0, 0)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(624, 470)
Me.TabControl1.TabIndex = 0
'
'TabPage1
'
Me.TabPage1.Controls.Add(Me.TextBox1)
Me.TabPage1.Controls.Add(Me.Label1)
Me.TabPage1.Controls.Add(Me.RadioButton2)
Me.TabPage1.Controls.Add(Me.RadioButton1)
Me.TabPage1.Controls.Add(Me.ComboBox4)
Me.TabPage1.Controls.Add(Me.ComboBox3)
Me.TabPage1.Controls.Add(Me.DataGrid1)
Me.TabPage1.Controls.Add(Me.Button1)
Me.TabPage1.Controls.Add(Me.ComboBox2)
Me.TabPage1.Controls.Add(Me.ComboBox1)
Me.TabPage1.Controls.Add(Me.GroupBox1)
Me.TabPage1.Location = New System.Drawing.Point(4, 21)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(616, 445)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "材料名称---查询单价"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(144, 120)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(152, 21)
Me.TextBox1.TabIndex = 11
Me.TextBox1.Text = ""
'
'Label1
'
Me.Label1.ForeColor = System.Drawing.Color.Red
Me.Label1.Location = New System.Drawing.Point(328, 128)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(104, 16)
Me.Label1.TabIndex = 10
Me.Label1.Text = "输入材料名称"
'
'RadioButton2
'
Me.RadioButton2.Location = New System.Drawing.Point(48, 120)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.Size = New System.Drawing.Size(72, 24)
Me.RadioButton2.TabIndex = 9
Me.RadioButton2.Text = "模糊查询"
'
'RadioButton1
'
Me.RadioButton1.Location = New System.Drawing.Point(48, 32)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.Size = New System.Drawing.Size(72, 24)
Me.RadioButton1.TabIndex = 8
Me.RadioButton1.Text = "准确查询"
'
'ComboBox4
'
Me.ComboBox4.Location = New System.Drawing.Point(320, 32)
Me.ComboBox4.Name = "ComboBox4"
Me.ComboBox4.Size = New System.Drawing.Size(152, 20)
Me.ComboBox4.TabIndex = 7
Me.ComboBox4.Text = "产品名称"
'
'ComboBox3
'
Me.ComboBox3.Enabled = False
Me.ComboBox3.Location = New System.Drawing.Point(144, 32)
Me.ComboBox3.Name = "ComboBox3"
Me.ComboBox3.Size = New System.Drawing.Size(152, 20)
Me.ComboBox3.TabIndex = 6
Me.ComboBox3.Text = "费用类别"
'
'DataGrid1
'
Me.DataGrid1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.DataGrid1.CaptionText = "材料的查询结果"
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(8, 168)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.ReadOnly = True
Me.DataGrid1.Size = New System.Drawing.Size(600, 264)
Me.DataGrid1.TabIndex = 4
'
'Button1
'
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Location = New System.Drawing.Point(496, 120)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 3
Me.Button1.Text = "确 定"
'
'ComboBox2
'
Me.ComboBox2.Location = New System.Drawing.Point(320, 80)
Me.ComboBox2.Name = "ComboBox2"
Me.ComboBox2.Size = New System.Drawing.Size(152, 20)
Me.ComboBox2.TabIndex = 2
Me.ComboBox2.Text = "产品参数"
'
'ComboBox1
'
Me.ComboBox1.Location = New System.Drawing.Point(144, 80)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(152, 20)
Me.ComboBox1.TabIndex = 1
Me.ComboBox1.Text = "产品名称(细化)"
'
'GroupBox1
'
Me.GroupBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.GroupBox1.Location = New System.Drawing.Point(8, 8)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(600, 152)
Me.GroupBox1.TabIndex = 12
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "查 询 选 择"
'
'Frm_zongjingli_gongchengcailiao_chaxun
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(624, 470)
Me.Controls.Add(Me.TabControl1)
Me.Name = "Frm_zongjingli_gongchengcailiao_chaxun"
Me.Text = "工程材料综合查询"
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
ComboBox4.Enabled = True
ComboBox1.Enabled = False
ComboBox2.Enabled = False
Button1.Enabled = False
Dim str, str1, str2 As String
Dim i, y As Integer
Dim mydataset As New DataSet
str1 = ComboBox3.Text.Trim
str = "select [CD1+2名称] from material_cd12 where 费用名称 = '" + str1 + "'"
mydataset = GetDataFromDB(str)
y = mydataset.Tables(0).Rows.Count
ComboBox4.Items.Clear()
For i = 0 To y - 1
str2 = Trim(mydataset.Tables(0).Rows(i)("CD1+2名称"))
ComboBox4.Items.Add(str2)
Next
mydataset.Dispose()
End Sub
Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
ComboBox1.Enabled = True
Button1.Enabled = False
ComboBox2.Enabled = False
Dim str, str1, str2 As String
Dim i, y As Integer
Dim mydataset As New DataSet
str1 = ComboBox4.Text.Trim
str = "select [CD3+4名称] from material_cd34 where [CD1+2名称] = '" + str1 + "'"
mydataset = GetDataFromDB(str)
y = mydataset.Tables(0).Rows.Count
ComboBox1.Items.Clear()
For i = 0 To y - 1
str2 = Trim(mydataset.Tables(0).Rows(i)("CD3+4名称"))
ComboBox1.Items.Add(str2)
Next
mydataset.Dispose()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox2.Enabled = True
Button1.Enabled = True
Dim str, str1, str2 As String
Dim i, y As Integer
Dim mydataset As New DataSet
str1 = ComboBox1.Text.Trim
str = "select 参数 from material_canshu where [CD3+4名称] = '" + str1 + "'"
mydataset = GetDataFromDB(str)
y = mydataset.Tables(0).Rows.Count
ComboBox2.Items.Clear()
For i = 0 To y - 1
str2 = Trim(mydataset.Tables(0).Rows(i)("参数"))
ComboBox2.Items.Add(str2)
Next
mydataset.Dispose()
End Sub
'根据要求查询
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked = True And ComboBox2.Enabled = True Then
Dim str, str1, str2 As String
Dim mydataset As New DataSet
str1 = ComboBox1.Text.Trim
str2 = ComboBox2.Text.Trim
str = "select 采购单编号,[CD3+4编码],物品名称,参数,数量,供应商名称,供应商单价,是否订购 from dinggou_cailiao_baojiadan where 物品名称 = '" + str1 + "' and 参数 = '" + str2 + "'"
mydataset = GetDataFromDB(str)
DataGrid1.DataSource = mydataset
mydataset.Dispose()
ElseIf ComboBox2.Enabled = False And RadioButton1.Checked = True Then
MsgBox("请选择详细的查询项!", MsgBoxStyle.Information, "提示")
Exit Sub
ElseIf RadioButton2.Checked = True Then
Dim astr, a, str1 As String
Dim mydataset As New DataSet
a = TextBox1.Text.Trim
str1 = " 物品名称 like " + Chr(39) + "%" + a + "%" + Chr(39)
astr = "select 采购单编号,[CD3+4编码],物品名称,参数,数量,供应商名称,供应商单价,是否订购 from dinggou_cailiao_baojiadan where " + str1
mydataset = GetDataFromDB(astr)
DataGrid1.DataSource = mydataset
mydataset.Dispose()
Else
MsgBox("您还没有选择查询方式,请先选择查询方式!", MsgBoxStyle.Information, "提示")
Exit Sub
End If
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
If RadioButton1.Checked = True Then
ComboBox3.Enabled = True
ComboBox4.Enabled = False
ComboBox1.Enabled = False
ComboBox2.Enabled = False
Dim str, str1, str2 As String
Dim i, y As Integer
Dim mydataset As New DataSet
str = "select 费用名称 from material_zongbiao"
mydataset = GetDataFromDB(str)
y = mydataset.Tables(0).Rows.Count
ComboBox3.Items.Clear()
For i = 0 To y - 1
str2 = Trim(mydataset.Tables(0).Rows(i)("费用名称"))
ComboBox3.Items.Add(str2)
Next
mydataset.Dispose()
End If
End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
ComboBox3.Enabled = False
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -