frm_deldata.frm
来自「完整的物资管理系统源码」· FRM 代码 · 共 120 行
FRM
120 行
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frm_deldata
Caption = "清除部分或全部表中的数据"
ClientHeight = 3795
ClientLeft = 60
ClientTop = 345
ClientWidth = 6420
LinkTopic = "Form1"
ScaleHeight = 3795
ScaleWidth = 6420
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "退出"
Height = 360
Left = 4485
TabIndex = 5
Top = 3315
Width = 1230
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 255
Left = 45
TabIndex = 4
Top = 2940
Visible = 0 'False
Width = 6315
_ExtentX = 11139
_ExtentY = 450
_Version = 393216
Appearance = 1
End
Begin VB.CommandButton cmdDel
Caption = "初始化"
Height = 360
Left = 3210
TabIndex = 3
Top = 3315
Width = 1230
End
Begin VB.CommandButton cmdNotAllSel
Caption = "全不选"
Height = 360
Left = 1935
TabIndex = 2
Top = 3315
Width = 1230
End
Begin VB.CommandButton cmdAllSel
Caption = "全选"
Height = 360
Left = 660
TabIndex = 1
Top = 3315
Width = 1230
End
Begin VB.ListBox List1
Height = 2790
ItemData = "frm_deldata.frx":0000
Left = 45
List = "frm_deldata.frx":0002
Style = 1 'Checkbox
TabIndex = 0
Top = 60
Width = 6330
End
End
Attribute VB_Name = "frm_deldata"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Form_Load()
Dim rstSchema As ADODB.Recordset
Set rstSchema = cnn.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
If rstSchema!table_name Like "tb*" Then
List1.AddItem rstSchema!table_name
End If
rstSchema.MoveNext
Loop
rstSchema.Close
End Sub
Private Sub cmdAllSel_Click() '全选
For i = 0 To List1.ListCount - 1
List1.Selected(i) = True
Next i
End Sub
Private Sub cmdNotAllSel_Click() '全不选
For i = 0 To List1.ListCount - 1
List1.Selected(i) = False
Next i
End Sub
Private Sub cmdDel_Click() '清除所选表中数据
Dim Counter As Integer '定义一个整型变量
Dim Workarea(250) As String '定义字符串变量
ProgressBar1.Visible = True
ProgressBar1.Max = UBound(Workarea)
ProgressBar1.Min = LBound(Workarea)
'设置进度的值为 Min
ProgressBar1.Value = ProgressBar1.Min
'在整个数组中循环
For Counter = LBound(Workarea) To UBound(Workarea)
'设置数组中每项的初始值
Workarea(Counter) = Counter
ProgressBar1.Value = Counter
For i = 0 To List1.ListCount - 1
If List1.Selected(i) = True Then
cnn1.Execute ("delete from " & List1.List(i))
End If
Next i
Next Counter
ProgressBar1.Visible = False
ProgressBar1.Value = ProgressBar1.Min
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?