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

📄 goodsaddmod.vb

📁 本文件为进销存管理系统的代码 在VB的环境下运行 用比较简单的结构完成的
💻 VB
字号:
Public Class GoodsAddMod
    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 Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents cmdOK As System.Windows.Forms.Button
    Friend WithEvents cmdCancel As System.Windows.Forms.Button
    Friend WithEvents txtGoodsID As System.Windows.Forms.TextBox
    Friend WithEvents txtGoodsName As System.Windows.Forms.TextBox
    Friend WithEvents txtCoumtMAX As System.Windows.Forms.TextBox
    Friend WithEvents txtCountMin As System.Windows.Forms.TextBox
    Friend WithEvents txtRemark As System.Windows.Forms.TextBox
    Friend WithEvents cmbPGroup As System.Windows.Forms.ComboBox
    Friend WithEvents cmbCGroup As System.Windows.Forms.ComboBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label7 = New System.Windows.Forms.Label
        Me.txtGoodsID = New System.Windows.Forms.TextBox
        Me.txtGoodsName = New System.Windows.Forms.TextBox
        Me.txtCoumtMAX = New System.Windows.Forms.TextBox
        Me.txtCountMin = New System.Windows.Forms.TextBox
        Me.txtRemark = New System.Windows.Forms.TextBox
        Me.cmdOK = New System.Windows.Forms.Button
        Me.cmdCancel = New System.Windows.Forms.Button
        Me.cmbPGroup = New System.Windows.Forms.ComboBox
        Me.cmbCGroup = New System.Windows.Forms.ComboBox
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(32, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 16)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "货品编号:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(32, 56)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(72, 16)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "货品名称:"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(32, 88)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 16)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "存储上限:"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(32, 120)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(72, 16)
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "存储下限:"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(32, 152)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(48, 16)
        Me.Label5.TabIndex = 4
        Me.Label5.Text = "类别:"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(32, 184)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(72, 16)
        Me.Label6.TabIndex = 5
        Me.Label6.Text = "详细类别:"
        '
        'Label7
        '
        Me.Label7.Location = New System.Drawing.Point(32, 224)
        Me.Label7.Name = "Label7"
        Me.Label7.Size = New System.Drawing.Size(48, 16)
        Me.Label7.TabIndex = 6
        Me.Label7.Text = "备注:"
        '
        'txtGoodsID
        '
        Me.txtGoodsID.Location = New System.Drawing.Point(128, 24)
        Me.txtGoodsID.MaxLength = 10
        Me.txtGoodsID.Name = "txtGoodsID"
        Me.txtGoodsID.Size = New System.Drawing.Size(120, 21)
        Me.txtGoodsID.TabIndex = 7
        Me.txtGoodsID.Text = ""
        '
        'txtGoodsName
        '
        Me.txtGoodsName.Location = New System.Drawing.Point(128, 56)
        Me.txtGoodsName.MaxLength = 10
        Me.txtGoodsName.Name = "txtGoodsName"
        Me.txtGoodsName.Size = New System.Drawing.Size(120, 21)
        Me.txtGoodsName.TabIndex = 8
        Me.txtGoodsName.Text = ""
        '
        'txtCoumtMAX
        '
        Me.txtCoumtMAX.Location = New System.Drawing.Point(128, 88)
        Me.txtCoumtMAX.MaxLength = 8
        Me.txtCoumtMAX.Name = "txtCoumtMAX"
        Me.txtCoumtMAX.Size = New System.Drawing.Size(120, 21)
        Me.txtCoumtMAX.TabIndex = 9
        Me.txtCoumtMAX.Text = ""
        '
        'txtCountMin
        '
        Me.txtCountMin.Location = New System.Drawing.Point(128, 120)
        Me.txtCountMin.MaxLength = 8
        Me.txtCountMin.Name = "txtCountMin"
        Me.txtCountMin.Size = New System.Drawing.Size(120, 21)
        Me.txtCountMin.TabIndex = 10
        Me.txtCountMin.Text = ""
        '
        'txtRemark
        '
        Me.txtRemark.Location = New System.Drawing.Point(128, 216)
        Me.txtRemark.MaxLength = 50
        Me.txtRemark.Multiline = True
        Me.txtRemark.Name = "txtRemark"
        Me.txtRemark.Size = New System.Drawing.Size(168, 80)
        Me.txtRemark.TabIndex = 11
        Me.txtRemark.Text = ""
        '
        'cmdOK
        '
        Me.cmdOK.Location = New System.Drawing.Point(64, 312)
        Me.cmdOK.Name = "cmdOK"
        Me.cmdOK.TabIndex = 14
        Me.cmdOK.Text = "确 定"
        '
        'cmdCancel
        '
        Me.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.cmdCancel.Location = New System.Drawing.Point(184, 312)
        Me.cmdCancel.Name = "cmdCancel"
        Me.cmdCancel.TabIndex = 15
        Me.cmdCancel.Text = "取 消"
        '
        'cmbPGroup
        '
        Me.cmbPGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbPGroup.Location = New System.Drawing.Point(128, 152)
        Me.cmbPGroup.MaxDropDownItems = 20
        Me.cmbPGroup.Name = "cmbPGroup"
        Me.cmbPGroup.Size = New System.Drawing.Size(121, 20)
        Me.cmbPGroup.TabIndex = 16
        '
        'cmbCGroup
        '
        Me.cmbCGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbCGroup.Location = New System.Drawing.Point(128, 184)
        Me.cmbCGroup.MaxDropDownItems = 50
        Me.cmbCGroup.Name = "cmbCGroup"
        Me.cmbCGroup.Size = New System.Drawing.Size(121, 20)
        Me.cmbCGroup.TabIndex = 17
        '
        'GoodsAddMod
        '
        Me.AcceptButton = Me.cmdOK
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.CancelButton = Me.cmdCancel
        Me.ClientSize = New System.Drawing.Size(352, 350)
        Me.Controls.Add(Me.cmbCGroup)
        Me.Controls.Add(Me.cmbPGroup)
        Me.Controls.Add(Me.cmdCancel)
        Me.Controls.Add(Me.cmdOK)
        Me.Controls.Add(Me.txtRemark)
        Me.Controls.Add(Me.txtCountMin)
        Me.Controls.Add(Me.txtCoumtMAX)
        Me.Controls.Add(Me.txtGoodsName)
        Me.Controls.Add(Me.txtGoodsID)
        Me.Controls.Add(Me.Label7)
        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.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "GoodsAddMod"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "货品信息"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub GoodsAddMod_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        '显父类
        storename = "ShowParentGroup"
        Users.ShowAdmin(cmbPGroup)
        If ClickAdd = True Then
            Me.Text = "添加货品信息"
            cmbPGroup.Text = cmbPGroup.Items(0)
        Else
            Me.Text = "修改货品信息"
            txtGoodsID.Text = Trim(Temp(0))
            txtGoodsName.Text = Trim(Temp(1))
            cmbPGroup.Text = Trim(Temp(2))
            cmbCGroup.Text = Trim(Temp(3))
            txtCoumtMAX.Text = Trim(Temp(4))
            txtCountMin.Text = Trim(Temp(5))
            txtRemark.Text = Trim(Temp(6))
            txtGoodsID.Enabled = False
        End If
    End Sub

    '显示与父类对应的子类
    Private Sub cmbPGroup_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbPGroup.SelectedIndexChanged
        cmbCGroup.Items.Clear()
        Goods.ShowCGroup(cmbCGroup, cmbPGroup.SelectedIndex + 1)
        cmbCGroup.Text = cmbCGroup.Items(0)
    End Sub

    Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOK.Click
        If txtGoodsID.Text.Trim <> "" And txtGoodsName.Text.Trim <> "" Then
            Dim info(6) As String
            info(0) = txtGoodsID.Text.Trim
            info(1) = txtGoodsName.Text.Trim
            info(2) = cmbPGroup.Text.Trim
            info(3) = cmbCGroup.Text.Trim
            info(4) = txtCoumtMAX.Text.Trim
            info(5) = txtCountMin.Text.Trim
            info(6) = txtRemark.Text.Trim
            If ClickAdd = True Then
                storename = "CheckGoodsID"
                Stock.CheckID(info(0))
                If hasID = False Then
                    storename = "insert_bssTable_Goods_1"
                    Goods.AddModGoods(info)
                    MessageBox.Show("添加成功", "货品")
                    Me.Close()
                Else
                    MessageBox.Show("此货品号一存在,请从新输入!", "错误")
                    txtGoodsID.SelectAll()
                    txtGoodsID.Focus()
                End If
            Else
                storename = "update_bssTable_Goods_1"
                Goods.AddModGoods(info)
                MessageBox.Show("修改成功", "货品")
                Me.Close()
            End If
        Else
            MessageBox.Show("货物ID和货物名不能为空!", "错误")
        End If
    End Sub

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




End Class

⌨️ 快捷键说明

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