frmaddbook.vb

来自「The Management Information System of Lib」· VB 代码 · 共 1,047 行 · 第 1/3 页

VB
1,047
字号
        Me.txtBook_remarks.Multiline = True
        Me.txtBook_remarks.Name = "txtBook_remarks"
        Me.txtBook_remarks.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.txtBook_remarks.Size = New System.Drawing.Size(128, 104)
        Me.txtBook_remarks.TabIndex = 11
        Me.txtBook_remarks.Text = ""
        '
        'cboBook_sort
        '
        Me.cboBook_sort.Location = New System.Drawing.Point(280, 88)
        Me.cboBook_sort.Name = "cboBook_sort"
        Me.cboBook_sort.Size = New System.Drawing.Size(128, 20)
        Me.cboBook_sort.TabIndex = 10
        Me.cboBook_sort.Text = "ComboBox2"
        '
        'cboBook_place
        '
        Me.cboBook_place.Location = New System.Drawing.Point(280, 56)
        Me.cboBook_place.Name = "cboBook_place"
        Me.cboBook_place.Size = New System.Drawing.Size(128, 20)
        Me.cboBook_place.TabIndex = 9
        Me.cboBook_place.Text = "ComboBox1"
        '
        'dtpBook_adddate
        '
        Me.dtpBook_adddate.Location = New System.Drawing.Point(280, 32)
        Me.dtpBook_adddate.Name = "dtpBook_adddate"
        Me.dtpBook_adddate.Size = New System.Drawing.Size(128, 21)
        Me.dtpBook_adddate.TabIndex = 8
        '
        'dtpBook_pubdate
        '
        Me.dtpBook_pubdate.Location = New System.Drawing.Point(80, 144)
        Me.dtpBook_pubdate.Name = "dtpBook_pubdate"
        Me.dtpBook_pubdate.Size = New System.Drawing.Size(128, 21)
        Me.dtpBook_pubdate.TabIndex = 4
        '
        'txtBook_price
        '
        Me.txtBook_price.BackColor = System.Drawing.Color.White
        Me.txtBook_price.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_price.Location = New System.Drawing.Point(80, 224)
        Me.txtBook_price.Name = "txtBook_price"
        Me.txtBook_price.Size = New System.Drawing.Size(128, 21)
        Me.txtBook_price.TabIndex = 7
        Me.txtBook_price.Text = ""
        '
        'Label12
        '
        Me.Label12.Location = New System.Drawing.Point(216, 112)
        Me.Label12.Name = "Label12"
        Me.Label12.Size = New System.Drawing.Size(64, 16)
        Me.Label12.TabIndex = 17
        Me.Label12.Text = "备注:"
        '
        'Label11
        '
        Me.Label11.ForeColor = System.Drawing.Color.Red
        Me.Label11.Location = New System.Drawing.Point(216, 88)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(64, 16)
        Me.Label11.TabIndex = 16
        Me.Label11.Text = "图书分类:"
        '
        'txtBook_author
        '
        Me.txtBook_author.BackColor = System.Drawing.Color.White
        Me.txtBook_author.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_author.Location = New System.Drawing.Point(80, 168)
        Me.txtBook_author.Name = "txtBook_author"
        Me.txtBook_author.Size = New System.Drawing.Size(128, 21)
        Me.txtBook_author.TabIndex = 5
        Me.txtBook_author.Text = ""
        '
        'Label10
        '
        Me.Label10.Location = New System.Drawing.Point(216, 32)
        Me.Label10.Name = "Label10"
        Me.Label10.Size = New System.Drawing.Size(64, 16)
        Me.Label10.TabIndex = 14
        Me.Label10.Text = "入馆日期:"
        '
        'txtBook_page
        '
        Me.txtBook_page.BackColor = System.Drawing.Color.White
        Me.txtBook_page.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_page.Location = New System.Drawing.Point(80, 200)
        Me.txtBook_page.Name = "txtBook_page"
        Me.txtBook_page.Size = New System.Drawing.Size(128, 21)
        Me.txtBook_page.TabIndex = 6
        Me.txtBook_page.Text = ""
        '
        'Label9
        '
        Me.Label9.ForeColor = System.Drawing.Color.Red
        Me.Label9.Location = New System.Drawing.Point(216, 56)
        Me.Label9.Name = "Label9"
        Me.Label9.Size = New System.Drawing.Size(64, 16)
        Me.Label9.TabIndex = 12
        Me.Label9.Text = "存放位置:"
        '
        'txtBook_isbn
        '
        Me.txtBook_isbn.BackColor = System.Drawing.Color.White
        Me.txtBook_isbn.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_isbn.Location = New System.Drawing.Point(80, 112)
        Me.txtBook_isbn.Name = "txtBook_isbn"
        Me.txtBook_isbn.Size = New System.Drawing.Size(128, 21)
        Me.txtBook_isbn.TabIndex = 3
        Me.txtBook_isbn.Text = ""
        '
        'Label8
        '
        Me.Label8.Location = New System.Drawing.Point(8, 224)
        Me.Label8.Name = "Label8"
        Me.Label8.Size = New System.Drawing.Size(64, 16)
        Me.Label8.TabIndex = 10
        Me.Label8.Text = "图书价格:"
        '
        'txtBook_pub
        '
        Me.txtBook_pub.BackColor = System.Drawing.Color.White
        Me.txtBook_pub.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_pub.Location = New System.Drawing.Point(80, 88)
        Me.txtBook_pub.Name = "txtBook_pub"
        Me.txtBook_pub.Size = New System.Drawing.Size(128, 21)
        Me.txtBook_pub.TabIndex = 2
        Me.txtBook_pub.Text = ""
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(8, 200)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(64, 16)
        Me.Label7.TabIndex = 8
        Me.Label7.Text = "图书页数:"
        '
        'txtBook_name
        '
        Me.txtBook_name.BackColor = System.Drawing.Color.White
        Me.txtBook_name.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_name.Location = New System.Drawing.Point(80, 56)
        Me.txtBook_name.Name = "txtBook_name"
        Me.txtBook_name.Size = New System.Drawing.Size(128, 21)
        Me.txtBook_name.TabIndex = 1
        Me.txtBook_name.Text = ""
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(8, 168)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(64, 16)
        Me.Label6.TabIndex = 6
        Me.Label6.Text = "图书作者:"
        '
        'txtBook_code
        '
        Me.txtBook_code.BackColor = System.Drawing.Color.White
        Me.txtBook_code.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.txtBook_code.Location = New System.Drawing.Point(80, 32)
        Me.txtBook_code.Name = "txtBook_code"
        Me.txtBook_code.Size = New System.Drawing.Size(112, 21)
        Me.txtBook_code.TabIndex = 0
        Me.txtBook_code.Text = ""
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(8, 144)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(64, 16)
        Me.Label5.TabIndex = 4
        Me.Label5.Text = "出版日期:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(8, 112)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(64, 16)
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "ISBN号:"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(8, 88)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(64, 16)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "出版社:"
        '
        'Label2
        '
        Me.Label2.ForeColor = System.Drawing.Color.Red
        Me.Label2.Location = New System.Drawing.Point(8, 56)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(64, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "图书题名:"
        '
        'Label1
        '
        Me.Label1.ForeColor = System.Drawing.Color.Red
        Me.Label1.Location = New System.Drawing.Point(8, 32)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(64, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "条码号:"
        '
        'TextBox1
        '
        Me.TextBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.TextBox1.BackColor = System.Drawing.SystemColors.Info
        Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
        Me.TextBox1.Location = New System.Drawing.Point(584, 280)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(128, 248)
        Me.TextBox1.TabIndex = 2
        Me.TextBox1.TabStop = False
        Me.TextBox1.Text = ""
        '
        'FrmAddBook
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(712, 533)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.dbgBook)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "FrmAddBook"
        Me.Text = "图书管理"
        CType(Me.dbgBook, System.ComponentModel.ISupportInitialize).EndInit()
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox3.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
#Region "自定义函数"
    Function setEmpty()
        Me.txtBook_author.Text = ""
        Me.txtBook_code.Text = ""
        Me.txtBook_id.Text = "自动编号"
        Me.txtBook_idFind.Text = ""
        Me.txtBook_isbn.Text = ""
        Me.txtBook_name.Text = ""
        Me.txtBook_page.Text = ""
        Me.txtBook_price.Text = ""
        Me.txtBook_pub.Text = ""
        Me.txtBook_remarks.Text = ""
        Me.txtBookcodeFind.Text = ""

        Me.btnDelete1Book.Enabled = False
        Me.btnEditBook.Enabled = False
        Me.btnAdd.Enabled = True

        Me.dtpBook_adddate.Text = ""
        Me.cboBook_sort.Text = ""
        Me.cboBook_place.Text = ""

        Me.txtBook_code.Focus()
    End Function
    Function dbgbind()
        Dim cnLib2004 As SqlConnection

        Dim daBook As SqlDataAdapter
        Dim drBookSort As SqlDataReader
        Dim drPlace As SqlDataReader

        Dim cmdbook As SqlCommand
        Dim cmdbooksort As SqlCommand
        Dim cmdplace As SqlCommand

        Dim dsBook As New DataSet

        cnLib2004 = New SqlConnection(cnstr)
        cmdbook = New SqlCommand
        With cmdbook
            .CommandType = CommandType.StoredProcedure
            .CommandText = "SelectAllBook"
            .Connection = cnLib2004
        End With
        daBook = New SqlDataAdapter(cmdbook)

        cmdbooksort = New SqlCommand
        With cmdbooksort
            .CommandType = CommandType.StoredProcedure
            .Connection = cnLib2004
            .CommandText = "selectBookSort"
        End With
   

        cmdplace = New SqlCommand
        With cmdplace
            .CommandType = CommandType.StoredProcedure
            .Connection = cnLib2004
            .CommandText = "selectPlace"
        End With


        Try
            daBook.Fill(dsBook)
            Me.dbgBook.DataSource = dsBook.Tables(0)

            cnLib2004.Open()
            drBooksort = cmdbooksort.ExecuteReader
            Dim myarr As New ArrayList
            While drBooksort.Read
                myarr.Add(drBooksort.Item(0))
            End While
            Me.cboBook_sort.DataSource = myarr
            drBookSort.Close()

            drPlace = cmdplace.ExecuteReader
            myarr.Clear()
            With drPlace
                While .Read
                    myarr.Add(.Item(0))
                End While
            End With
            Me.cboBook_place.DataSource = myarr
            drPlace.Close()

        Catch ex As Exception
            MessageBox.Show(ex.Message)
            Me.Close()
        Finally
            cnLib2004.Close()
            dsBook.Dispose()
            'drBookSort.Close()
            'drPlace.Close()
        End Try


    End Function
    Function BindComboBox1()
        Dim cnLib2004 As SqlConnection
        Dim cmdbooksort As SqlCommand
        Dim drBooksort As SqlDataReader

        cnLib2004 = New SqlConnection(cnstr)
        cmdbooksort = New SqlCommand
        With cmdbooksort
            .CommandType = CommandType.StoredProcedure
            .Connection = cnLib2004
            .CommandText = "selectBookSort"
        End With

⌨️ 快捷键说明

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