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

📄 frmsp.frm

📁 商品进销存软件
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmspinfo 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "商品设置"
   ClientHeight    =   6000
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7815
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6000
   ScaleWidth      =   7815
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Caption         =   "商品信息浏览"
      Height          =   4455
      Left            =   120
      TabIndex        =   6
      Top             =   360
      Width           =   7575
      Begin MSFlexGridLib.MSFlexGrid msgList 
         Height          =   4095
         Left            =   120
         TabIndex        =   7
         Top             =   240
         Width           =   7335
         _ExtentX        =   12938
         _ExtentY        =   7223
         _Version        =   393216
         AllowUserResizing=   1
      End
   End
   Begin VB.Frame Frame1 
      Height          =   975
      Left            =   120
      TabIndex        =   1
      Top             =   4920
      Width           =   7575
      Begin VB.CommandButton Command4 
         Caption         =   "返回"
         Height          =   375
         Left            =   5640
         TabIndex        =   5
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton Command3 
         Caption         =   "删除"
         Height          =   375
         Left            =   3915
         TabIndex        =   4
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton Command2 
         Caption         =   "修改"
         Height          =   375
         Left            =   2205
         TabIndex        =   3
         Top             =   360
         Width           =   1335
      End
      Begin VB.CommandButton Command1 
         Caption         =   "添加"
         Height          =   375
         Left            =   480
         TabIndex        =   2
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "商品信息浏览"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   2760
      TabIndex        =   0
      Top             =   120
      Width           =   2295
   End
End
Attribute VB_Name = "frmspinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
Load frmsp
frmsp.Show
End Sub

Private Sub Command2_Click()
Dim intCount As Integer
Dim txtsql As String
    If msgList.Rows > 1 Then
        gintDHmode = 2
        intCount = msgList.Row
        If intCount > 0 Then
           txtsql = "select * from 商品表 where 商品编号 ='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
           Load frmsp
           frmsp.showdata (txtsql)
           frmsp.Show 1, frmspinfo
        Else
            MsgBox "警告", vbOKOnly + vbExclamation, "请首先选择需要修改的纪录!"
        End If
    End If
End Sub

Private Sub Command3_Click()
  Dim txtsql As String
    Dim intCount As Integer
    Dim MsgText As String

    If msgList.Rows > 1 Then
        If MsgBox("确认要删除编号为" & Trim(msgList.TextMatrix(msgList.Row, 1)) & "的记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
            intCount = msgList.Row
            txtsql = "delete from 商品表 where 商品编号 ='" & Trim(msgList.TextMatrix(intCount, 1)) & "'"
            ExeSQL (txtsql)
            MsgBox "记录删除成功!", vbInformation, "系统提示"
            Call showdata
            msgList.Refresh
        End If
    End If
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Load()
Call ShowTitle
Call showdata
End Sub
Public Sub ShowTitle()
    Dim i As Integer
    
    With msgList
        .Cols = 7
        .TextMatrix(0, 1) = "商品编号"
        .TextMatrix(0, 2) = "商品名称"
        .TextMatrix(0, 3) = "零售价"
        .TextMatrix(0, 4) = "批发价"
        .TextMatrix(0, 5) = "备注"
        
        .FixedRows = 1
                
        For i = 0 To 6
            .ColAlignment(i) = 0
        Next i
        .FillStyle = flexFillRepeat
        .Col = 0
        .Row = 0
        .RowSel = 1
        .ColSel = .Cols - 1
        .CellAlignment = 4
        .ColWidth(0) = 500
        .ColWidth(1) = 1000
        .ColWidth(2) = 1000
        .ColWidth(3) = 1000
        .ColWidth(4) = 1000
        .ColWidth(5) = 1000
        .ColWidth(6) = 5000
        .Row = 1
        
    End With
End Sub

Private Sub msgList_EnterCell()
msgList.SelectionMode = flexSelectionByRow
End Sub

Public Sub showdata()
 On Error GoTo errorhandle
    Dim j As Integer
    Dim i As Integer
    Dim sqlshow As String
    Dim mrc As ADODB.Recordset
    sqlshow = "select * from 商品表"
   
    Set mrc = ExeSQL(sqlshow)
     If mrc.EOF Then
        frmsp.Show 1, frmspinfo
        mrc.Close
        Set mrc = Nothing
        Exit Sub
    End If
    With msgList
        .Rows = 1
        
        Do While Not mrc.EOF
            .Rows = .Rows + 1
            For i = 1 To mrc.Fields.Count
                If Not IsNull(Trim(mrc.Fields(i - 1))) Then
                Select Case mrc.Fields(i - 1).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
                End Select
                End If
            Next i
            mrc.MoveNext
        Loop
        
          
    End With
    mrc.Close
    Exit Sub
errorhandle:
If Err.Number = 400 Then
Resume Next
End If
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set frmspinfo = Nothing
End Sub

⌨️ 快捷键说明

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