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

📄 frmfindbookclass.vb

📁 基于VB.NET开发的简单的图书馆管理系统,可正常运行以测试,内带源码.
💻 VB
字号:

Imports System.Data
Imports System.Data.SqlClient

Public Class frmfindbookclass
    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 btshow As System.Windows.Forms.Button
    Friend WithEvents btcancel As System.Windows.Forms.Button
    Friend WithEvents lbshow As System.Windows.Forms.ListBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmfindbookclass))
        Me.btshow = New System.Windows.Forms.Button
        Me.btcancel = New System.Windows.Forms.Button
        Me.lbshow = New System.Windows.Forms.ListBox
        Me.SuspendLayout()
        '
        'btshow
        '
        Me.btshow.Location = New System.Drawing.Point(184, 32)
        Me.btshow.Name = "btshow"
        Me.btshow.Size = New System.Drawing.Size(32, 56)
        Me.btshow.TabIndex = 1
        Me.btshow.Text = "查找"
        '
        'btcancel
        '
        Me.btcancel.Location = New System.Drawing.Point(184, 152)
        Me.btcancel.Name = "btcancel"
        Me.btcancel.Size = New System.Drawing.Size(32, 56)
        Me.btcancel.TabIndex = 2
        Me.btcancel.Text = "取消"
        '
        'lbshow
        '
        Me.lbshow.ItemHeight = 12
        Me.lbshow.Location = New System.Drawing.Point(3, 5)
        Me.lbshow.Name = "lbshow"
        Me.lbshow.Size = New System.Drawing.Size(176, 256)
        Me.lbshow.TabIndex = 3
        '
        'frmfindbookclass
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(232, 266)
        Me.Controls.Add(Me.lbshow)
        Me.Controls.Add(Me.btcancel)
        Me.Controls.Add(Me.btshow)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmfindbookclass"
        Me.Text = "frmfindbookclass"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub btshow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btshow.Click
        lbshow.Items.Clear()
        Dim strsource As String = "workstation id=郭洪博;packet size=4096;integrated security=SSPI;initial catalog=books;persist security info=False"
        Dim strselect As String = "select classname from bookclassinfo"
        Dim conn As SqlConnection = New SqlConnection(strsource)
        Try
            conn.Open()
            Dim cmd As SqlCommand = New SqlCommand(strselect, conn)
            Dim reader As SqlDataReader = cmd.ExecuteReader
            If Not reader.HasRows Then
                'conn.Close()
                Exit Sub

            End If
            While reader.Read()
                lbshow.Items.Add(reader.Item("classname").ToString().Trim())
            End While
            conn.Close()
        Catch ex As Exception
            MessageBox.Show(ex.GetBaseException.ToString())
        End Try
        
        

    End Sub

    Private Sub btcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btcancel.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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