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

📄 frm_unlockuser.vb

📁 用vb.net+SQL做的,本系统实现了图书管理系统应该具有的特色
💻 VB
字号:
Imports System.Data.OleDb
Public Class frm_UnlockUser
    Inherits System.Windows.Forms.Form
    Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Library.mdb")
    Dim MyCommand
    Dim MyReader As OleDbDataReader
    Dim lockedUser As String
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    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

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents BtnUnlock As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frm_UnlockUser))
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.ListBox1 = New System.Windows.Forms.ListBox
        Me.BtnUnlock = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.ListBox1)
        Me.GroupBox1.Location = New System.Drawing.Point(10, 9)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(336, 198)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "冻结用户"
        '
        'ListBox1
        '
        Me.ListBox1.ItemHeight = 12
        Me.ListBox1.Location = New System.Drawing.Point(10, 17)
        Me.ListBox1.Name = "ListBox1"
        Me.ListBox1.Size = New System.Drawing.Size(316, 172)
        Me.ListBox1.TabIndex = 0
        '
        'BtnUnlock
        '
        Me.BtnUnlock.Location = New System.Drawing.Point(58, 223)
        Me.BtnUnlock.Name = "BtnUnlock"
        Me.BtnUnlock.Size = New System.Drawing.Size(115, 34)
        Me.BtnUnlock.TabIndex = 1
        Me.BtnUnlock.Text = "解冻"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(173, 223)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(115, 34)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "退出"
        '
        'frm_UnlockUser
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(365, 269)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.BtnUnlock)
        Me.Controls.Add(Me.GroupBox1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frm_UnlockUser"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "解冻用户"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
    Private Sub frm_UnlockUser_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim status As String
        status = "冻结"
        MyConnection.Open()
        MyCommand = New OleDbCommand("SELECT * FROM SystemUsers WHERE Status ='" & status & "'", MyConnection)
        MyReader = MyCommand.ExecuteReader()
        While MyReader.Read
            ListBox1.Items.Add(MyReader("UserID"))
        End While
        MyConnection.Close()
        MyReader.Close()
        MyCommand.dispose()
    End Sub
    Function updatestatus()
        Dim okstatus As String
        okstatus = "正常"
        MyConnection.Open()
        MyCommand = New OleDbCommand("UPDATE SystemUsers SET Status ='" & okstatus & "' WHERE UserID = '" & lockedUser & "'", MyConnection)
        Try
            MyCommand.ExecuteNonQuery()
        Catch c As Exception
            MsgBox(c.ToString)
        End Try
        MyConnection.Close()
        MyCommand.dispose()
    End Function
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        lockedUser = ListBox1.SelectedItem
    End Sub
   
    Function displayMsg(ByVal myMsgText As String)
        MsgBox(myMsgText, MsgBoxStyle.Information, "图书馆管理系统")
    End Function

    Private Sub BtnUnlock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnUnlock.Click
        updatestatus()
        ListBox1.Items.Remove(ListBox1.SelectedItem)
        displayMsg("用户已被解冻")
    End Sub
End Class

⌨️ 快捷键说明

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