⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cx.vb

📁 图书管理系统VB.NET版本
💻 VB
📖 第 1 页 / 共 2 页
字号:
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("SimSun", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label2.ForeColor = System.Drawing.SystemColors.ActiveCaption
        Me.Label2.Location = New System.Drawing.Point(40, 137)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(48, 16)
        Me.Label2.TabIndex = 3
        Me.Label2.Text = "字段2"
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("SimSun", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.Label1.ForeColor = System.Drawing.SystemColors.ActiveCaption
        Me.Label1.Location = New System.Drawing.Point(40, 40)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(48, 16)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "字段1"
        '
        'Field2
        '
        Me.Field2.Location = New System.Drawing.Point(16, 153)
        Me.Field2.Name = "Field2"
        Me.Field2.Size = New System.Drawing.Size(96, 20)
        Me.Field2.TabIndex = 1
        Me.Field2.Text = "主编"
        '
        'Field1
        '
        Me.Field1.Location = New System.Drawing.Point(16, 64)
        Me.Field1.Name = "Field1"
        Me.Field1.Size = New System.Drawing.Size(96, 20)
        Me.Field1.TabIndex = 0
        Me.Field1.Text = "书名"
        '
        'GroupBox3
        '
        Me.GroupBox3.Controls.Add(Me.RadioButton5)
        Me.GroupBox3.Controls.Add(Me.RadioButton4)
        Me.GroupBox3.Controls.Add(Me.RadioButton3)
        Me.GroupBox3.Controls.Add(Me.RadioButton2)
        Me.GroupBox3.Controls.Add(Me.RadioButton1)
        Me.GroupBox3.Location = New System.Drawing.Point(16, 12)
        Me.GroupBox3.Name = "GroupBox3"
        Me.GroupBox3.Size = New System.Drawing.Size(296, 72)
        Me.GroupBox3.TabIndex = 2
        Me.GroupBox3.TabStop = False
        Me.GroupBox3.Text = "选择书库"
        '
        'RadioButton5
        '
        Me.RadioButton5.Location = New System.Drawing.Point(236, 20)
        Me.RadioButton5.Name = "RadioButton5"
        Me.RadioButton5.Size = New System.Drawing.Size(50, 32)
        Me.RadioButton5.TabIndex = 4
        Me.RadioButton5.Text = "信科"
        '
        'RadioButton4
        '
        Me.RadioButton4.Location = New System.Drawing.Point(178, 24)
        Me.RadioButton4.Name = "RadioButton4"
        Me.RadioButton4.Size = New System.Drawing.Size(48, 24)
        Me.RadioButton4.TabIndex = 3
        Me.RadioButton4.Text = "物理"
        '
        'RadioButton3
        '
        Me.RadioButton3.Location = New System.Drawing.Point(114, 16)
        Me.RadioButton3.Name = "RadioButton3"
        Me.RadioButton3.Size = New System.Drawing.Size(56, 40)
        Me.RadioButton3.TabIndex = 2
        Me.RadioButton3.Text = "通信"
        '
        'RadioButton2
        '
        Me.RadioButton2.Location = New System.Drawing.Point(60, 24)
        Me.RadioButton2.Name = "RadioButton2"
        Me.RadioButton2.Size = New System.Drawing.Size(48, 24)
        Me.RadioButton2.TabIndex = 1
        Me.RadioButton2.Text = "数学"
        '
        'RadioButton1
        '
        Me.RadioButton1.Checked = True
        Me.RadioButton1.Location = New System.Drawing.Point(11, 24)
        Me.RadioButton1.Name = "RadioButton1"
        Me.RadioButton1.Size = New System.Drawing.Size(48, 24)
        Me.RadioButton1.TabIndex = 0
        Me.RadioButton1.TabStop = True
        Me.RadioButton1.Text = "力学"
        '
        'cx
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(650, 286)
        Me.ControlBox = False
        Me.Controls.Add(Me.GroupBox3)
        Me.Controls.Add(Me.GroupBox2)
        Me.Controls.Add(Me.GroupBox1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Name = "cx"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "图书查询"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox3.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        OleSuccess = False
        Me.Close()
    End Sub


    Private Sub Field1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Field1.LostFocus
        If Field1.Text.EndsWith("日期") Then
            Value1.Visible = False
            DateTimePicker1.Visible = True
        Else
            Value1.Visible = True
            DateTimePicker1.Visible = False
        End If
    End Sub


    Private Sub Field2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Field2.LostFocus
        If Field2.Text.EndsWith("日期") Then
            Value2.Visible = False
            DateTimePicker2.Visible = True
        Else
            Value2.Visible = True
            DateTimePicker2.Visible = False
        End If
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click    '无条件检索
        Dim Sqlstr As String
        Dim i As Int16
        'CountItem = "数理系图书一览表-"
        If ListBox2.Items.Count = 0 Then
            MessageBox.Show("必须选择浏览字段!", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        Else
            Sqlstr = "SELECT " & FieldMapping(Trim(ListBox2.Items(0).ToString))
            For i = 1 To ListBox2.Items.Count - 1
                Sqlstr = Sqlstr & "," & FieldMapping(Trim(ListBox2.Items(i).ToString))
            Next
            Sqlstr = Sqlstr & "  from " & type_book
            Call ReadMdb(Sqlstr)
            'all = True
            If OleSuccess Then
                Me.Close()
            End If
        End If
        

    End Sub

    Private Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click    '条件检索数据
        Dim SqlStr As String    '检索字符串
        Dim str2 As String      '条件2表达式
        Dim i As Int16
        ' all = False
        'CountItem = "数理系图书一览表-"
        If ListBox2.Items.Count = 0 Then
            MessageBox.Show("必须选择浏览字段!", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        Else
            SqlStr = "SELECT " & FieldMapping(Trim(ListBox2.Items(0).ToString))
            For i = 1 To ListBox2.Items.Count - 1
                SqlStr = SqlStr & "," & FieldMapping(Trim(ListBox2.Items(i).ToString))
            Next
            SqlStr = SqlStr & " FROM " & type_book & " WHERE " & FieldMapping(Trim(Field1.Text))

            Select Case optchange(Trim(opt1.Text))
                Case "LIKE%%"    '包含
                    If Value1.Visible Then
                        SqlStr = SqlStr & " LIKE '%" & Trim(Value1.Text.ToUpper) & "%'"
                    Else
                        SqlStr = SqlStr & " LIKE '%" & Trim(DateTimePicker1.Value.ToShortDateString) & "%'"
                    End If
                Case "LIKE%"   '左包含
                    If Value1.Visible Then
                        SqlStr = SqlStr & " LIKE '" & Trim(Value1.Text.ToUpper) & "%'"
                    Else
                        SqlStr = SqlStr & " LIKE '" & Trim(DateTimePicker1.Value.ToShortDateString) & "%'"
                    End If
                Case "LIKE"    '右包含
                    If Value1.Visible Then
                        SqlStr = SqlStr & " LIKE  '%" & Trim(Value1.Text.ToUpper) & "'"
                    Else
                        SqlStr = SqlStr & " LIKE '% " & Trim(DateTimePicker1.Value.ToShortDateString) & "'"
                    End If
                Case Else
                    If Value1.Visible Then
                        If Trim(Field1.Text) <> "单价" Then
                            SqlStr = SqlStr & optchange(Trim(opt1.Text)) & "'" & Trim(Value1.Text) & "'"
                        Else
                            SqlStr = SqlStr & optchange(Trim(opt1.Text)) & Trim(Value1.Text)
                        End If
                    Else
                        SqlStr = SqlStr & optchange(Trim(opt1.Text)) & "'" & Trim(DateTimePicker1.Value.ToShortDateString) & "'"
                    End If
            End Select

            Select Case optchange(Trim(opt2.Text))
                Case "LIKE%%"    '包含
                    If Value2.Visible Then
                        str2 = FieldMapping(Trim(Field2.Text)) & " LIKE '%" & Trim(Value2.Text.ToUpper) & "%'"
                    Else
                        str2 = FieldMapping(Trim(Field2.Text)) & " LIKE '%" & Trim(DateTimePicker2.Value.ToShortDateString) & "%'"
                    End If
                Case "LIKE%"   '左包含
                    If Value2.Visible Then
                        str2 = FieldMapping(Trim(Field2.Text)) & " LIKE '" & Trim(Value2.Text.ToUpper) & "%'"
                    Else
                        str2 = FieldMapping(Trim(Field2.Text)) & " LIKE '" & Trim(DateTimePicker2.Value.ToShortDateString) & "%'"
                    End If
                Case "LIKE"    '右包含
                    If Value2.Visible Then
                        str2 = FieldMapping(Trim(Field2.Text)) & " LIKE '%" & Trim(Value2.Text.ToUpper) & "'"
                    Else
                        str2 = FieldMapping(Trim(Field2.Text)) & " LIKE  '%" & Trim(DateTimePicker2.Value.ToShortDateString) & "'"
                    End If
                Case Else
                    If Value2.Visible Then
                        If Trim(Field2.Text) <> "单价" Then
                            str2 = FieldMapping(Trim(Field2.Text)) & optchange(Trim(opt2.Text)) & " '" & Trim(Value2.Text) & "'"
                        Else
                            str2 = FieldMapping(Trim(Field2.Text)) & optchange(Trim(opt2.Text)) & Trim(Value2.Text)
                        End If
                    Else
                        str2 = FieldMapping(Trim(Field2.Text)) & optchange(Trim(opt2.Text)) & "'" & Trim(DateTimePicker2.Value.ToShortDateString) & "'"
                    End If
            End Select
            If Relation1.Checked Then
                SqlStr = SqlStr & " AND " & str2
            ElseIf Relation2.Checked Then
                SqlStr = SqlStr & " OR " & str2
            End If
            Call ReadMdb(SqlStr)
            If OleSuccess Then
                Me.Close()
            End If
        End If
        

    End Sub

    Private Sub RadioButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton1.Click
        type_book = "lixue"
        'CountItem = CountItem & "力学"
    End Sub

    Private Sub RadioButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton2.Click
        type_book = "shuxue"
        ' CountItem = CountItem & "数学"
    End Sub

    Private Sub RadioButton3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton3.Click
        type_book = "tongxinziliao"
        'CountItem = CountItem & "通信资料"
    End Sub

    Private Sub RadioButton4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton4.Click
        type_book = "wuli"
        'CountItem = CountItem & "物理"
    End Sub

    Private Sub RadioButton5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButton5.Click
        type_book = "xinkeziliao"
        'CountItem = CountItem & "信科资料"
    End Sub

    Private Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If ListBox1.SelectedItems.Count <> 0 Then
            ListBox2.Items.Add(ListBox1.SelectedItem.ToString)
            ListBox1.Items.Remove(ListBox1.SelectedItem)
        Else
            MessageBox.Show("必须选择移动项", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If
    End Sub

    Private Sub Button2_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        If ListBox2.SelectedItems.Count <> 0 Then
            ListBox1.Items.Add(ListBox2.SelectedItem.ToString)
            ListBox2.Items.Remove(ListBox2.SelectedItem)
        Else
            MessageBox.Show("必须选择移动项", "警告信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If
    End Sub

    Private Sub Button3_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim i As Int16
        For i = 0 To ListBox1.Items.Count - 1
            ListBox2.Items.Add(ListBox1.Items.Item(i).ToString)
        Next
        ListBox1.Items.Clear()
    End Sub

    Private Sub Button4_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim i As Int16
        For i = 0 To ListBox2.Items.Count - 1
            ListBox1.Items.Add(ListBox2.Items.Item(i).ToString)
        Next
        ListBox2.Items.Clear()
    End Sub

    Private Sub cx_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
        type_book = "lixue"
    End Sub

    Private Sub cx_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        Dim ch As String
        CountItem = "数理系图书一览—"
        Select Case type_book
            Case "lixue"
                ch = "力学"
            Case "shuxue"
                ch = "数学"
            Case "wuli"
                ch = "物理"
            Case "tongxinziliao"
                ch = "通信资料"
            Case "xinkeziliao"
                ch = "信科资料"
        End Select
        CountItem = CountItem & ch
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -