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

📄 main_kcgl_sp.frm

📁 完整的物资管理系统源码
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Picture         =   "main_kcgl_sp.frx":353D
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   795
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   10395
      _ExtentX        =   18336
      _ExtentY        =   1402
      ButtonWidth     =   1138
      ButtonHeight    =   1349
      Appearance      =   1
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   12
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   " 增加 "
            Key             =   "add"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "修改"
            Key             =   "modify"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "删除"
            Key             =   "delete"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "保存"
            Key             =   "save"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "取消"
            Key             =   "cancel"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "查找"
            Key             =   "find"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
         EndProperty
         BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
            Style           =   3
         EndProperty
         BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "关闭"
            Key             =   "close"
            ImageIndex      =   7
         EndProperty
      EndProperty
      BorderStyle     =   1
   End
   Begin VB.Frame Frame1 
      Height          =   1290
      Left            =   15
      TabIndex        =   1
      Top             =   750
      Width           =   10380
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   330
         Index           =   0
         Left            =   825
         TabIndex        =   13
         Top             =   150
         Width           =   975
      End
      Begin MSDataListLib.DataCombo DataCombo1 
         Bindings        =   "main_kcgl_sp.frx":4417
         Height          =   330
         Left            =   2640
         TabIndex        =   11
         Top             =   150
         Width           =   2025
         _ExtentX        =   3572
         _ExtentY        =   582
         _Version        =   393216
         Locked          =   -1  'True
         Style           =   2
         ListField       =   "类别名称"
         BoundColumn     =   "类别名称"
         Text            =   "DataCombo1"
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   3
         Left            =   6315
         Locked          =   -1  'True
         TabIndex        =   9
         Top             =   510
         Width           =   3990
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   4
         Left            =   825
         Locked          =   -1  'True
         TabIndex        =   8
         Top             =   885
         Width           =   9480
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   2
         Left            =   825
         Locked          =   -1  'True
         TabIndex        =   6
         Top             =   525
         Width           =   4710
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   1
         Left            =   5520
         Locked          =   -1  'True
         TabIndex        =   3
         Top             =   150
         Width           =   4785
      End
      Begin VB.Label Label10 
         Caption         =   "物资编号"
         ForeColor       =   &H000000FF&
         Height          =   165
         Left            =   60
         TabIndex        =   14
         Top             =   225
         Width           =   795
      End
      Begin VB.Label Label9 
         Caption         =   "计量单位"
         Height          =   165
         Left            =   5565
         TabIndex        =   12
         Top             =   615
         Width           =   795
      End
      Begin VB.Label Label5 
         Caption         =   "材质"
         Height          =   165
         Left            =   360
         TabIndex        =   10
         Top             =   945
         Width           =   405
      End
      Begin VB.Label Label4 
         Caption         =   "规格型号"
         ForeColor       =   &H000000FF&
         Height          =   165
         Left            =   60
         TabIndex        =   7
         Top             =   600
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "物资名称"
         ForeColor       =   &H000000FF&
         Height          =   165
         Left            =   4755
         TabIndex        =   5
         Top             =   225
         Width           =   795
      End
      Begin VB.Label Label1 
         Caption         =   "商品类别"
         Height          =   165
         Left            =   1875
         TabIndex        =   2
         Top             =   225
         Width           =   735
      End
   End
End
Attribute VB_Name = "main_kcgl_sp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public blnAdd As Boolean
Dim mybookmark
Sub view_data()
  Dim i As Integer
  If Adodc1.Recordset.RecordCount > 0 Then
    For i = 1 To text1.UBound
      text1(i) = DataGrid1.Columns(i + 1)
    Next i
    text1(0) = DataGrid1.Columns(1)
    DataCombo1 = DataGrid1.Columns(0)
  End If
End Sub
Private Sub DataCombo1_GotFocus()
  DataCombo1.BackColor = &HFFFF00
End Sub
Private Sub DataCombo1_LostFocus()
  DataCombo1.BackColor = &H80000005
End Sub
Private Sub DataCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then text1(1).SetFocus
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  view_data
End Sub
Private Sub Form_Activate()
  If sql1 <> "" Then
     Adodc1.RecordSource = sql1
     Adodc1.Refresh
     If Adodc1.Recordset.RecordCount > 0 Then
        view_data
     Else
        MsgBox "没有找到符合条件的记录!", , "提示窗口"
     End If
  End If
End Sub
Private Sub Form_Load()
  Me.Caption = text
  tlbState Toolbar1, False
  view_data
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  sql1 = ""
End Sub
Private Sub Text1_GotFocus(Index As Integer)
  text1(Index).BackColor = &HFFFF00
  text1(Index).SelStart = 0
  text1(Index).SelLength = Len(text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn And Index < 5 Then text1(Index + 1).SetFocus
End Sub
Private Sub Text1_LostFocus(Index As Integer)
  text1(Index).BackColor = &H80000005
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  Select Case Button.Key
     Case "add"
       blnAdd = True
       tlbState Toolbar1, True
       Dim rs1 As ADODB.Recordset
       Set rs1 = New ADODB.Recordset
       rs1.Open "select * from tb_kc", cnn, adOpenKeyset, adLockOptimistic
       If rs1.RecordCount > 0 Then
         rs1.MoveLast
         text1(0) = "m" & Format(Val(Right(rs1.Fields("物资编号"), 5)) + 1, "00000")
       Else
         text1(0) = "m00001"
       End If
       rs1.Close
       For i = 1 To text1.UBound
           text1(i) = ""
           text1(i).Locked = False
       Next i
       DataCombo1.text = ""
       DataCombo1.Locked = False
       DataCombo1.SetFocus
     Case "modify"
       If Adodc1.Recordset.RecordCount > 0 Then
         blnAdd = False
         tlbState Toolbar1, True
         For i = 1 To text1.UBound
             text1(i).Locked = False
         Next i
         DataCombo1.Locked = False
         view_data
         mybookmark = DataGrid1.Bookmark
       Else
         MsgBox "系统没有要修改的数据!", , "提示窗口"
       End If
     Case "delete"
       If Adodc1.Recordset.RecordCount > 0 Then
         Adodc1.Recordset.Delete
         Adodc1.Refresh
       Else
         MsgBox "系统没有要删除的数据!", , "提示窗口"
       End If
     Case "save"
       If text1(1).text = "" Then
          MsgBox "系统不允许〖物资名称〗为空!", , "提示窗口"
          Exit Sub
       End If
       If text1(2).text = "" Then
          MsgBox "系统不允许〖规格型号〗为空!", , "提示窗口"
          Exit Sub
       End If
       On Error GoTo SaveErr
       If blnAdd = True Then
         cnn.Execute ("insert into tb_kc(类别,物资编号,物资名称,规格型号,计量单位,材质) values('" + DataCombo1 + _
         "','" + text1(0) + "','" + text1(1) + "','" + text1(2) + "','" + text1(3) + "','" + text1(4) + "')")
         Adodc1.Refresh
         tlbState Toolbar1, False
         For i = 1 To text1.UBound
             text1(i).Locked = True
         Next i
         DataCombo1.Locked = True
       Else
         cnn.Execute ("update tb_kc set 类别 ='" + DataCombo1 + "',物资名称 ='" + text1(1) + "',规格型号 ='" + text1(2) + _
         "',计量单位 ='" + text1(3) + "',材质='" + text1(4) + "'where 物资编号 ='" + text1(0) + "'")
         Adodc1.Refresh
         DataGrid1.Bookmark = mybookmark
         view_data
         tlbState Toolbar1, False
         For i = 1 To text1.UBound
             text1(i).Locked = True
         Next i
         DataCombo1.Locked = True
       End If
       Exit Sub
SaveErr:
       MsgBox Err.Description
     Case "cancel"
       tlbState Toolbar1, False
       For i = 1 To text1.UBound
           text1(i).Locked = True
       Next i
       DataCombo1.Locked = True
       view_data
     Case "find"
       tb1 = "tb_kc"
       Load main_fzfind
       main_fzfind.Show 1
     Case "close"
       Unload Me
  End Select
End Sub

⌨️ 快捷键说明

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