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

📄 frm_standard_edit.frm

📁 前些年帮人写的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_Standard_Edit 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "药品信息修改"
   ClientHeight    =   2595
   ClientLeft      =   3495
   ClientTop       =   2835
   ClientWidth     =   5745
   Icon            =   "Frm_Standard_Edit.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2595
   ScaleWidth      =   5745
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   780
      TabIndex        =   9
      Top             =   180
      Width           =   1815
   End
   Begin VB.TextBox Text3 
      Height          =   300
      Left            =   780
      TabIndex        =   8
      Top             =   600
      Width           =   1815
   End
   Begin VB.TextBox Text4 
      Height          =   300
      Left            =   3720
      TabIndex        =   7
      Top             =   600
      Width           =   1815
   End
   Begin VB.TextBox Text5 
      Height          =   300
      Left            =   780
      TabIndex        =   6
      Top             =   1020
      Width           =   1815
   End
   Begin VB.TextBox Text6 
      Height          =   300
      Left            =   3720
      TabIndex        =   5
      Top             =   1020
      Width           =   1815
   End
   Begin VB.TextBox Text7 
      Height          =   300
      Left            =   780
      TabIndex        =   4
      Top             =   1440
      Width           =   1815
   End
   Begin VB.TextBox Text8 
      Height          =   300
      Left            =   3720
      TabIndex        =   3
      Top             =   1440
      Width           =   1815
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   3720
      Style           =   2  'Dropdown List
      TabIndex        =   2
      Top             =   180
      Width           =   1815
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   1020
      TabIndex        =   1
      Top             =   2040
      Width           =   1155
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   3360
      TabIndex        =   0
      Top             =   2040
      Width           =   1155
   End
   Begin VB.Label Label1 
      Caption         =   "药 名"
      Height          =   315
      Left            =   180
      TabIndex        =   17
      Top             =   240
      Width           =   495
   End
   Begin VB.Label Label2 
      Caption         =   "供应商"
      Height          =   255
      Left            =   2940
      TabIndex        =   16
      Top             =   240
      Width           =   675
   End
   Begin VB.Label Label3 
      Caption         =   "药 种"
      Height          =   315
      Left            =   180
      TabIndex        =   15
      Top             =   660
      Width           =   555
   End
   Begin VB.Label Label4 
      Caption         =   "规 格"
      Height          =   315
      Left            =   2940
      TabIndex        =   14
      Top             =   660
      Width           =   555
   End
   Begin VB.Label Label5 
      Caption         =   "包 装"
      Height          =   195
      Left            =   180
      TabIndex        =   13
      Top             =   1080
      Width           =   555
   End
   Begin VB.Label Label6 
      Caption         =   "单 位"
      Height          =   315
      Left            =   2940
      TabIndex        =   12
      Top             =   1080
      Width           =   555
   End
   Begin VB.Label Label7 
      Caption         =   "进 价"
      Height          =   255
      Left            =   180
      TabIndex        =   11
      Top             =   1500
      Width           =   495
   End
   Begin VB.Label Label8 
      Caption         =   "出 价"
      Height          =   315
      Left            =   2940
      TabIndex        =   10
      Top             =   1500
      Width           =   555
   End
End
Attribute VB_Name = "Frm_Standard_Edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    On Error GoTo myerr
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset

    If Trim(Text1) = "" Then
        MsgBox "药名不能为空!", vbExclamation, "提示"
        Text1.SetFocus
        Exit Sub
    End If

    If Trim(Text3) = "" Then
        MsgBox "药种不能为空!", vbExclamation, "提示"
        Text3.SetFocus
        Exit Sub
    End If
    If Trim(Text4) = "" Then
        MsgBox "规格不能为空!", vbExclamation, "提示"
        Text4.SetFocus
        Exit Sub
    End If
    If Trim(Text5) = "" Then
        MsgBox "包装不能为空!", vbExclamation, "提示"
        Text5.SetFocus
        Exit Sub
    End If
    If Trim(Text6) = "" Then
        MsgBox "单位不能为空!", vbExclamation, "提示"
        Text6.SetFocus
        Exit Sub
    End If
   If Not IsNumeric(Text7) Then
        MsgBox "请正确输入进价!", vbExclamation, "提示"
        Text7.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(Text8) Then
        MsgBox "请正确输入出价!", vbExclamation, "提示"
        Text8.SetFocus
        Exit Sub
    End If
    
    If Len(Text1) > 50 Then
        MsgBox "药名超长!", vbExclamation, "提示"
        Text1.SetFocus
        Exit Sub
    End If

    If Len(Text3) > 50 Then
        MsgBox "药种超长!", vbExclamation, "提示"
        Text3.SetFocus
        Exit Sub
    End If
    If Len(Text4) > 50 Then
        MsgBox "规格超长!", vbExclamation, "提示"
        Text4.SetFocus
        Exit Sub
    End If
    If Len(Text5) > 50 Then
        MsgBox "包装超长!", vbExclamation, "提示"
        Text5.SetFocus
        Exit Sub
    End If
    If Len(Text6) > 10 Then
        MsgBox "单位超长!", vbExclamation, "提示"
        Text6.SetFocus
        Exit Sub
    End If
    
    Set cn = GetCn
    cn.Execute "update standard set name='" & Text1 & "',supply_id=" & Combo1.ItemData(Combo1.ListIndex) & ",model='" & Text3 & "',normal='" & Text4 & "',packing='" & Text5 & "',unit='" & Text6 & "',in_price='" & Text7 & "',out_price='" & Text8 & "' where part_id=" & Frm_Standard.ListView1.SelectedItem.SubItems(8)
    MsgBox "已成功保存!", vbExclamation, "提示"
    Frm_Standard.ListView1.SelectedItem.Text = Text1
    Frm_Standard.ListView1.SelectedItem.SubItems(1) = Combo1
    Frm_Standard.ListView1.SelectedItem.SubItems(2) = Text3
    Frm_Standard.ListView1.SelectedItem.SubItems(3) = Text4
    Frm_Standard.ListView1.SelectedItem.SubItems(4) = Text5
    Frm_Standard.ListView1.SelectedItem.SubItems(5) = Text6
    Frm_Standard.ListView1.SelectedItem.SubItems(6) = Text7
    Frm_Standard.ListView1.SelectedItem.SubItems(7) = Text8
    Unload Me
    Exit Sub
myerr:
    MsgBox Error, vbExclamation, "提示"
    
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select short_name,supply_id from supply where stop=0", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "请先维护供应商信息!", vbExclamation, "提示"
        Command1.Enabled = False
        rst.Close
        cn.Close
        Exit Sub
    End If
    Combo1.Clear
    Do While Not rst.EOF
        Combo1.AddItem rst(0)
        Combo1.ItemData(Combo1.NewIndex) = rst(1)
        rst.MoveNext
    Loop
    Combo1.ListIndex = 0
    
    Text1 = Frm_Standard.ListView1.SelectedItem.Text
    Combo1 = Frm_Standard.ListView1.SelectedItem.SubItems(1)
    Text3 = Frm_Standard.ListView1.SelectedItem.SubItems(2)
    Text4 = Frm_Standard.ListView1.SelectedItem.SubItems(3)
    Text5 = Frm_Standard.ListView1.SelectedItem.SubItems(4)
    Text6 = Frm_Standard.ListView1.SelectedItem.SubItems(5)
    Text7 = Frm_Standard.ListView1.SelectedItem.SubItems(6)
    Text8 = Frm_Standard.ListView1.SelectedItem.SubItems(7)
    
End Sub

⌨️ 快捷键说明

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