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

📄 日志.frm

📁 一间公司的管理系统的源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form rzhi 
   Caption         =   "日志管理"
   ClientHeight    =   3735
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5370
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3735
   ScaleWidth      =   5370
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdClose 
      Caption         =   "关 闭"
      Height          =   375
      Left            =   3840
      TabIndex        =   4
      Top             =   3120
      Width           =   1335
   End
   Begin VB.CommandButton cmdClearSelect 
      Caption         =   "删除所选日志"
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   3120
      Width           =   1335
   End
   Begin VB.CommandButton cmdClearAll 
      Caption         =   "清空全部日志"
      Height          =   375
      Left            =   2040
      TabIndex        =   2
      Top             =   3120
      Width           =   1335
   End
   Begin VB.ListBox lstRZhi 
      Height          =   2400
      Left            =   240
      TabIndex        =   0
      Top             =   600
      Width           =   4935
   End
   Begin VB.Label lblRZTJ 
      Alignment       =   1  'Right Justify
      Caption         =   "共计X条日志"
      Height          =   255
      Left            =   3600
      TabIndex        =   5
      Top             =   360
      Width           =   1575
   End
   Begin VB.Label lblRZLB 
      Caption         =   "日志列表:"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   975
   End
End
Attribute VB_Name = "rzhi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim strList As String '将日志加入列表的临时变量
Dim sumList As Long '日志总记录数
Private Sub cmdClose_Click()
Unload Me
End Sub

Private Sub cmdClearAll_Click()
If MsgBox("清空日志列表后不可恢复,确定要清空吗?", vbYesNo, App.Title) = vbYes Then
    Close '关闭所有正在打开的文件,防止删除出错
    '删除日志文件
    Kill App.Path & LogfileName
    '创建空日志文件--开始
    Open App.Path & LogfileName For Random As #2
    Close #2
    '创建空日志文件--结束
    Call showRZ
    Call CheckButton
End If
End Sub

Private Sub cmdClearSelect_Click()
On Error GoTo zhangjunqiang 'ZhangJunQiang为李莹的老公姓名(张俊强)
    i = lstRZhi.ListIndex
    If lstRZhi.Selected(i) = True Then
        lstRZhi.RemoveItem i
    End If
    cmdClearSelect.Enabled = True
    cmdClearAll.Enabled = True
    '删除后保存日志文件
    Close
    Open App.Path & LogfileName For Output As #4
    For j = 0 To lstRZhi.ListCount - 1
        Print #4, lstRZhi.List(j)
    Next j
    Close #4
    
    Call showRZ
    Call CheckButton
zhangjunqiang:
End Sub

Private Sub Form_Load()

Call CheckLogin(Me)
Call SetCenter(Me)
Call showRZ
Call CheckButton

End Sub

Sub showRZ()

On Error GoTo LiYing 'LiYing为张俊强的妻子姓名(李莹)
lstRZhi.Clear
Close
sumList = 0
Open App.Path & LogfileName For Input As #3
Do
Line Input #3, strList
lstRZhi.AddItem strList
sumList = sumList + 1
If strList = "" Then Exit Do
Loop
Close #3

LiYing:
End Sub
Sub CheckButton()
'如果没有日志记录,使删除按钮不可用
If lstRZhi.ListCount = 0 Then
    cmdClearSelect.Enabled = False
    cmdClearAll.Enabled = False
Else
    cmdClearSelect.Enabled = True
    cmdClearAll.Enabled = True
End If
lblRZTJ.Caption = "共计 " & sumList & " 条日志"
End Sub

⌨️ 快捷键说明

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