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

📄 edittype.vb

📁 本人收集到的流水帐软件!小巧实用,希望对大家有说帮助.
💻 VB
字号:
Public Class EditType
    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 LabelName As System.Windows.Forms.Label
    Friend WithEvents TextBoxName As System.Windows.Forms.TextBox
    Friend WithEvents ButtonAdd As System.Windows.Forms.Button
    Friend WithEvents ListBoxType As System.Windows.Forms.ListBox
    Friend WithEvents ButtonDel As System.Windows.Forms.Button
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.LabelName = New System.Windows.Forms.Label
        Me.TextBoxName = New System.Windows.Forms.TextBox
        Me.ButtonAdd = New System.Windows.Forms.Button
        Me.ListBoxType = New System.Windows.Forms.ListBox
        Me.ButtonDel = New System.Windows.Forms.Button
        Me.Button1 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'LabelName
        '
        Me.LabelName.Location = New System.Drawing.Point(8, 8)
        Me.LabelName.Name = "LabelName"
        Me.LabelName.Size = New System.Drawing.Size(72, 23)
        Me.LabelName.TabIndex = 0
        Me.LabelName.Text = "类别名称:"
        Me.LabelName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'TextBoxName
        '
        Me.TextBoxName.Location = New System.Drawing.Point(80, 8)
        Me.TextBoxName.Name = "TextBoxName"
        Me.TextBoxName.Size = New System.Drawing.Size(96, 21)
        Me.TextBoxName.TabIndex = 1
        Me.TextBoxName.Text = ""
        '
        'ButtonAdd
        '
        Me.ButtonAdd.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.ButtonAdd.Location = New System.Drawing.Point(184, 8)
        Me.ButtonAdd.Name = "ButtonAdd"
        Me.ButtonAdd.Size = New System.Drawing.Size(53, 23)
        Me.ButtonAdd.TabIndex = 2
        Me.ButtonAdd.Text = "添加"
        '
        'ListBoxType
        '
        Me.ListBoxType.HorizontalScrollbar = True
        Me.ListBoxType.ItemHeight = 12
        Me.ListBoxType.Location = New System.Drawing.Point(8, 40)
        Me.ListBoxType.Name = "ListBoxType"
        Me.ListBoxType.Size = New System.Drawing.Size(344, 208)
        Me.ListBoxType.TabIndex = 3
        '
        'ButtonDel
        '
        Me.ButtonDel.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.ButtonDel.Location = New System.Drawing.Point(240, 8)
        Me.ButtonDel.Name = "ButtonDel"
        Me.ButtonDel.Size = New System.Drawing.Size(53, 23)
        Me.ButtonDel.TabIndex = 4
        Me.ButtonDel.Text = "删除"
        '
        'Button1
        '
        Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.Button1.Location = New System.Drawing.Point(296, 8)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(53, 23)
        Me.Button1.TabIndex = 5
        Me.Button1.Text = "返回"
        '
        'EditType
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(360, 254)
        Me.ControlBox = False
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.ButtonDel)
        Me.Controls.Add(Me.ListBoxType)
        Me.Controls.Add(Me.ButtonAdd)
        Me.Controls.Add(Me.TextBoxName)
        Me.Controls.Add(Me.LabelName)
        Me.MaximizeBox = False
        Me.MaximumSize = New System.Drawing.Size(368, 288)
        Me.MinimizeBox = False
        Me.MinimumSize = New System.Drawing.Size(368, 288)
        Me.Name = "EditType"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "小鱼流水帐 V1.0—类别管理"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim S As New S_TypeGuestInfo
    Dim Stemp As Boolean
    Private Sub EditType_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListTypeGuestInfo()
    End Sub

    Private Sub ButtonAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonAdd.Click
        S.Type_Name = Me.TextBoxName.Text
        S.Type_AdminName = AdminName
        If S.Type_Name = Nothing Then
            MsgBox("请输入类别名称!", MsgBoxStyle.Exclamation)
        Else
            With New D_TypeGuestInfo
                Stemp = .AddTypeName(S, ErrStr)
                If Stemp = True Then
                    Me.TextBoxName.Text = Nothing
                    ListTypeGuestInfo()
                Else
                    MsgBox("添加失败!")
                End If
            End With
        End If
    End Sub

    '读取数据库内容并显示出来
    Sub ListTypeGuestInfo()
        Me.ListBoxType.Items.Clear() '显示之前清除列表
        Dim TypeDataset As New DataSet
        Dim i As Integer
        S.Type_AdminName = AdminName
        With New D_TypeGuestInfo
            TypeDataset = .ListType(S, ErrStr)
            For i = 0 To TypeDataset.Tables(0).Rows.Count - 1
                Me.ListBoxType.Items.Add(TypeDataset.Tables(0).Rows(i)("Type_Name"))
            Next
        End With
    End Sub

    '选中listbox中数据时,在textboxname中显示出来
    Private Sub ListBoxType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBoxType.SelectedIndexChanged
        Me.TextBoxName.Text = Me.ListBoxType.SelectedItem.ToString
    End Sub

    '删除选中的类别
    Private Sub ButtonDel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDel.Click
        S.Type_Name = Me.TextBoxName.Text
        If S.Type_Name = Nothing Then
            MsgBox("请先选择要删除的类别!", MsgBoxStyle.Exclamation)
        End If
        S.Type_AdminName = AdminName
        With New D_TypeGuestInfo
            Stemp = .DelTypeName(S, ErrStr)
            If Stemp = True Then
                Me.TextBoxName.Text = Nothing
                ListTypeGuestInfo()
            Else
                MsgBox("删除失败!")
            End If
        End With
    End Sub

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

⌨️ 快捷键说明

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