browse.vb

来自「图书管理系统VB.NET版本」· VB 代码 · 共 652 行 · 第 1/3 页

VB
652
字号
        Me.OleDbUpdateCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_zgcs1", System.Data.OleDb.OleDbType.SmallInt, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "zgcs", System.Data.DataRowVersion.Original, Nothing))
        '
        'TextBox11
        '
        Me.TextBox11.Location = New System.Drawing.Point(122, 40)
        Me.TextBox11.Name = "TextBox11"
        Me.TextBox11.Size = New System.Drawing.Size(120, 23)
        Me.TextBox11.TabIndex = 43
        Me.TextBox11.Text = ""
        '
        'Label13
        '
        Me.Label13.Location = New System.Drawing.Point(51, 48)
        Me.Label13.Name = "Label13"
        Me.Label13.Size = New System.Drawing.Size(56, 24)
        Me.Label13.TabIndex = 44
        Me.Label13.Text = "ID 序"
        '
        'Button7
        '
        Me.Button7.Location = New System.Drawing.Point(328, 304)
        Me.Button7.Name = "Button7"
        Me.Button7.Size = New System.Drawing.Size(56, 32)
        Me.Button7.TabIndex = 45
        Me.Button7.Text = "修改"
        '
        'Browse
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(7, 16)
        Me.ClientSize = New System.Drawing.Size(578, 368)
        Me.ControlBox = False
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Label13)
        Me.Controls.Add(Me.TextBox11)
        Me.Controls.Add(Me.TextBox10)
        Me.Controls.Add(Me.TextBox9)
        Me.Controls.Add(Me.TextBox8)
        Me.Controls.Add(Me.TextBox7)
        Me.Controls.Add(Me.TextBox6)
        Me.Controls.Add(Me.TextBox5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button5)
        Me.Controls.Add(Me.Button4)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label10)
        Me.Controls.Add(Me.Label9)
        Me.Controls.Add(Me.Label7)
        Me.Controls.Add(Me.Label8)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Name = "Browse"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "浏览方式"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Browse_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ds = New DataSet   '数据表集合
        da = New OleDb.OleDbDataAdapter("SELECT * FROM " & type_book, ConAccess)  '引用方式
        da.Fill(ds, type_book)
        'OleDbDataAdapter1.Fill(ds, "book")      '控件直接链接方式
        TextBox11.DataBindings.Add("Text", ds.Tables(type_book), "ID")
        TextBox1.DataBindings.Add("Text", ds.Tables(type_book), "FLH")
        TextBox2.DataBindings.Add("Text", ds.Tables(type_book), "SM")
        TextBox3.DataBindings.Add("Text", ds.Tables(type_book), "ZB")
        TextBox4.DataBindings.Add("Text", ds.Tables(type_book), "CBS")
        TextBox5.DataBindings.Add("Text", ds.Tables(type_book), "DJ")
        TextBox6.DataBindings.Add("Text", ds.Tables(type_book), "BC")
        TextBox7.DataBindings.Add("Text", ds.Tables(type_book), "ZD")
        TextBox8.DataBindings.Add("Text", ds.Tables(type_book), "JYZ")
        TextBox9.DataBindings.Add("Text", ds.Tables(type_book), "JSRQ")
        TextBox10.DataBindings.Add("Text", ds.Tables(type_book), "HSRQ")
        Row = ds.Tables(type_book).Rows
        TextBox1.Enabled = False
        TextBox2.Enabled = False
        TextBox3.Enabled = False
        TextBox4.Enabled = False
        TextBox5.Enabled = False
        TextBox6.Enabled = False
        TextBox7.Enabled = False
        TextBox8.Enabled = False
        TextBox9.Enabled = False
        TextBox10.Enabled = False
        TextBox11.Enabled = False
        
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        TheRow = 0
        TextBox11.Text = Row(TheRow).Item(0).ToString
        TextBox1.Text = Row(TheRow).Item(1).ToString
        TextBox2.Text = Row(TheRow).Item(2).ToString
        TextBox3.Text = Row(TheRow).Item(3).ToString
        TextBox4.Text = Row(TheRow).Item(4).ToString
        TextBox5.Text = Row(TheRow).Item(5).ToString
        TextBox6.Text = Row(TheRow).Item(6).ToString
        TextBox7.Text = Row(TheRow).Item(7).ToString
        TextBox8.Text = Row(TheRow).Item(8).ToString
        TextBox9.Text = Row(TheRow).Item(9).ToString
        TextBox10.Text = Row(TheRow).Item(10).ToString
        
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        TheRow = Row.Count - 1
        TextBox11.Text = Row(TheRow).Item(0).ToString
        TextBox1.Text = Row(TheRow).Item(1).ToString
        TextBox2.Text = Row(TheRow).Item(2).ToString
        TextBox3.Text = Row(TheRow).Item(3).ToString
        TextBox4.Text = Row(TheRow).Item(4).ToString
        TextBox5.Text = Row(TheRow).Item(5).ToString
        TextBox6.Text = Row(TheRow).Item(6).ToString
        TextBox7.Text = Row(TheRow).Item(7).ToString
        TextBox8.Text = Row(TheRow).Item(8).ToString
        TextBox9.Text = Row(TheRow).Item(9).ToString
        TextBox10.Text = Row(TheRow).Item(10).ToString
        
    End Sub

    Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        If TheRow > 0 Then
            TheRow = TheRow - 1
            TextBox11.Text = Row(TheRow).Item(0).ToString
            TextBox1.Text = Row(TheRow).Item(1).ToString
            TextBox2.Text = Row(TheRow).Item(2).ToString
            TextBox3.Text = Row(TheRow).Item(3).ToString
            TextBox4.Text = Row(TheRow).Item(4).ToString
            TextBox5.Text = Row(TheRow).Item(5).ToString
            TextBox6.Text = Row(TheRow).Item(6).ToString
            TextBox7.Text = Row(TheRow).Item(7).ToString
            TextBox8.Text = Row(TheRow).Item(8).ToString
            TextBox9.Text = Row(TheRow).Item(9).ToString
            TextBox10.Text = Row(TheRow).Item(10).ToString
            
        Else
            MessageBox.Show("已经到了文件首部!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If
    End Sub

    Private Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
        If TheRow < Row.Count - 1 Then
            TheRow = TheRow + 1
            TextBox11.Text = Row(TheRow).Item(0).ToString
            TextBox1.Text = Row(TheRow).Item(1).ToString
            TextBox2.Text = Row(TheRow).Item(2).ToString
            TextBox3.Text = Row(TheRow).Item(3).ToString
            TextBox4.Text = Row(TheRow).Item(4).ToString
            TextBox5.Text = Row(TheRow).Item(5).ToString
            TextBox6.Text = Row(TheRow).Item(6).ToString
            TextBox7.Text = Row(TheRow).Item(7).ToString
            TextBox8.Text = Row(TheRow).Item(8).ToString
            TextBox9.Text = Row(TheRow).Item(9).ToString
            TextBox10.Text = Row(TheRow).Item(10).ToString
            
        Else
            MessageBox.Show("已经到了文件尾部!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        TextBox1.Enabled = True
        TextBox2.Enabled = True
        TextBox3.Enabled = True
        TextBox4.Enabled = True
        TextBox5.Enabled = True
        TextBox6.Enabled = True
        TextBox7.Enabled = True
        'TextBox8.Enabled = True
        'TextBox9.Enabled = True
        'TextBox10.Enabled = True
        TextBox11.Enabled = True
        
    End Sub

    Private Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click    '修改确认
        Dim str As String
        str = "Update " & type_book & "  set FLH='" & Trim(TextBox1.Text) & "',SM='" & Trim(TextBox2.Text) & "',ZB='" & _
Trim(TextBox3.Text) & "',CBS='" & Trim(TextBox4.Text) & "',DJ=" & Trim(TextBox5.Text) & ",BC='" & Trim(TextBox6.Text) & "',ZD='" & Trim(TextBox7.Text) & _
  "' Where ID=" & "'" & Trim(TextBox11.Text) & "'"

        Call WriteMdb(str)
        TextBox1.Enabled = False
        TextBox2.Enabled = False
        TextBox3.Enabled = False
        TextBox4.Enabled = False
        TextBox5.Enabled = False
        TextBox6.Enabled = False
        TextBox7.Enabled = False
        'TextBox8.Enabled = False
        'TextBox9.Enabled = False
        'TextBox10.Enabled = False
        TextBox11.Enabled = False

    End Sub

End Class

⌨️ 快捷键说明

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