📄 form12.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmDeleteUser
BackColor = &H00FFC0C0&
Caption = "删除用户"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 390
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 9375
Left = 1200
Picture = "Form12.frx":0000
ScaleHeight = 9315
ScaleWidth = 7035
TabIndex = 5
Top = 1080
Width = 7095
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "用户列表"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 7935
Left = 9120
TabIndex = 3
Top = 960
Width = 8655
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3855
Left = 360
TabIndex = 4
Top = 960
Width = 8055
_ExtentX = 14208
_ExtentY = 6800
_Version = 393216
Rows = 5
Cols = 5
RowHeightMin = 20
BackColorBkg = 16761024
MergeCells = 2
AllowUserResizing= 3
End
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 12840
TabIndex = 2
Top = 9840
Width = 1935
End
Begin VB.CommandButton cmdReturn
Caption = "返回"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 15240
TabIndex = 1
Top = 9840
Width = 1935
End
Begin VB.CommandButton cmdDelete
Caption = "删除"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 10440
TabIndex = 0
Top = 9840
Width = 1935
End
End
Attribute VB_Name = "frmDeleteUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
List1.Text = ""
Rs.Updata
End Sub
Private Sub cmdDelete_Click()
Dim Rs As ADODB.Recordset
If List1.List(List1.ListIndex) <> "" Then
If MsgBox("确实要删除当前记录吗?", " & list1.List(list1.ListIndex) &", vbOKCancel + vbExclamation, "警告") = vbOK Then
txtsql = "delete from user where 用户名=" & List1.List(List1.ListIndex) & ""
Set Rs = ExecuteSQL(txtsql, MsgText)
List1.Clear
From_load
Rs.Close
Set Rs = Nothing
End If
End If
MsgBox "删除成功", vbOKOnly, "提示"
End Sub
Private Sub cmdReturn_Click()
Unload Me
frmAdmainUser.Show
End Sub
Private Sub Form_Load()
Call Module1.connection
Dim textsql As String
Dim MsgText As String
strsql = "select * form 用户信息表"
Set Rs = ExecuteSQL(txtsql, MsgText)
While Rs.EOF = False
ShowData '读入所有的用户到列表中来
Wend
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
End Sub
Private Sub ShowData()
Dim j As Integer
Dim i As Integer
Set Rs = ExecuteSQL(txtsql, MsgText)
With msgList
.Rows = 1
Do While Not Rs.EOF
.Rows = .Rows + 1
For i = 1 To Rs.Fields.Count
Select Case Rs.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(Rs.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = Rs.Fields(i - 1) & ""
End Select
Next i
Rs.MoveNext
Loop
End With
Rs.Close
End Sub
Private Sub ShowTitle()
Dim i As Integer
With msgList
.Cols = 8
.TextMatrix(0, 1) = ""
.TextMatrix(0, 2) = "用户名"
.TextMatrix(0, 3) = "性别"
.TextMatrix(0, 4) = "用户类型"
.TextMatrix(0, 5) = "密码"
.TextMatrix(0, 6) = "身份证号"
'固定表头
.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) = 300
.ColWidth(1) = 0
.ColWidth(2) = 1000
.ColWidth(3) = 2000
.ColWidth(4) = 2000
.ColWidth(5) = 1000
.ColWidth(6) = 1000
.ColWidth(7) = 600
.Row = 1
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -