www.pudn.com > jxc001.rar > FrmSetUser.frm
VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmSetUser
Caption = "操作员设置"
ClientHeight = 5895
ClientLeft = 60
ClientTop = 345
ClientWidth = 4170
Icon = "FrmSetUser.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 5895
ScaleWidth = 4170
Begin VB.Frame Frame2
Height = 2595
Left = 0
TabIndex = 8
Top = 3300
Width = 4155
Begin VB.TextBox txtuser_pass
DataField = "user_pass"
DataMember = "ComUsers"
DataSource = "DEjxc"
Enabled = 0 'False
Height = 285
IMEMode = 3 'DISABLE
Left = 1770
PasswordChar = "*"
TabIndex = 14
Top = 1065
Width = 1350
End
Begin VB.TextBox txtuser_name
DataField = "user_name"
DataMember = "ComUsers"
DataSource = "DEjxc"
Enabled = 0 'False
Height = 285
Left = 1770
TabIndex = 12
Top = 630
Width = 1320
End
Begin VB.CommandButton CmdAct
Caption = "恢复(&U)"
Enabled = 0 'False
Height = 315
Index = 1
Left = 2340
TabIndex = 10
Top = 1680
Width = 1275
End
Begin VB.CommandButton CmdAct
Caption = "保存(&S)"
Enabled = 0 'False
Height = 315
Index = 0
Left = 420
TabIndex = 9
Top = 1680
Width = 1275
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "密码:"
Height = 180
Index = 1
Left = 1290
TabIndex = 13
Top = 1110
Width = 450
End
Begin VB.Label lblFieldLabel
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "操作员姓名:"
Height = 180
Index = 0
Left = 750
TabIndex = 11
Top = 675
Width = 990
End
End
Begin VB.Frame Frame1
Height = 3375
Left = 0
TabIndex = 0
Top = -60
Width = 4155
Begin VB.CommandButton CmdDep
Caption = "退出(&X)"
Height = 315
Index = 5
Left = 2640
TabIndex = 7
Top = 2940
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "列表(&P)"
Height = 315
Index = 4
Left = 2640
TabIndex = 6
Top = 2388
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "删除(&D)"
Height = 315
Index = 3
Left = 2640
TabIndex = 5
Top = 1836
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "查询(&F)"
Height = 315
Index = 2
Left = 2640
TabIndex = 4
Top = 1284
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "编辑(&E)"
Height = 315
Index = 1
Left = 2640
TabIndex = 3
Top = 732
Width = 1275
End
Begin VB.CommandButton CmdDep
Caption = "增加(&N)"
Height = 315
Index = 0
Left = 2640
TabIndex = 2
Top = 180
Width = 1275
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "FrmSetUser.frx":0442
Height = 3075
Left = 120
TabIndex = 1
Top = 180
Width = 2355
_ExtentX = 4154
_ExtentY = 5424
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = -1 'True
HeadLines = 1
RowHeight = 15
TabAcrossSplits = -1 'True
TabAction = 2
WrapCellPointer = -1 'True
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
DataMember = "ComUsers"
ColumnCount = 2
BeginProperty Column00
DataField = "user_name"
Caption = "操作员姓名"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "user_pass"
Caption = "user_pass"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnAllowSizing= 0 'False
ColumnWidth = 1184.882
EndProperty
BeginProperty Column01
ColumnAllowSizing= 0 'False
Object.Visible = 0 'False
ColumnWidth = 1365.165
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "FrmSetUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rsUser As ADODB.Recordset
Private blnIsSQL As Boolean
Private Sub CmdAct_Click(Index As Integer)
With rsUser
Select Case Index
Case 0
If Me.txtuser_name = "" Or Me.txtuser_pass = "" Then
MsgBox "姓名或密码不能为空!", vbCritical, "错误"
Me.txtuser_name.SetFocus
Exit Sub
End If
.UpdateBatch
.AddNew
.CancelUpdate
.MoveLast
Case 1
.CancelUpdate
If .RecordCount <> 0 Then
.MoveFirst
End If
End Select
End With
Call IsEdit(False)
Me.DataGrid1.Refresh
End Sub
Private Sub CmdDep_Click(Index As Integer)
Dim intAnswer As Integer
Select Case Index
Case 0
Call UserAddNew
Case 1
Call IsEdit(True)
Me.txtuser_name.SetFocus
Case 2
FrmSql.intNumField = 1
FrmSql.Show vbModal
Select Case FrmSql.intNumField
Case -1
blnIsSQL = False
CmdDep(0).Enabled = True
CmdDep(3).Enabled = True
rsUser.Filter = Me.DataGrid1.Columns.Item(0).DataField & _
"<>''"
Case -2
Case Else
blnIsSQL = True
CmdDep(0).Enabled = False
CmdDep(3).Enabled = False
rsUser.Filter = Me.DataGrid1.Columns.Item(FrmSql.intNumField).DataField & _
" like '*" & FrmSql.strSqlField & "*'"
End Select
Case 3
intAnswer = MsgBox("确认删除当前记录吗?", vbYesNo + vbQuestion, "删除确认")
If intAnswer = vbYes Then
With rsUser
.Delete
.UpdateBatch
If .RecordCount <> 0 Then
.MoveFirst
End If
End With
End If
Case 4
Case 5
Unload Me
End Select
End Sub
Private Sub Form_Load()
intNumWindows = OpenWindow(intNumWindows)
Me.Height = 6300
Me.Width = 4290
Call SetFormStu(Me, frmMain)
Set rsUser = DEjxc.rsComUsers
Call IsEdit(False)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If CmdDep(5).Enabled = False Then
MsgBox "请先退出编辑状态后再退出该程序!", , "提示"
Cancel = True
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
intNumWindows = Closewindow(intNumWindows)
rsUser.Filter = Me.DataGrid1.Columns.Item(0).DataField & "<>''"
rsUser.Close
Set rsUser = Nothing
End Sub
Private Sub UserAddNew()
Dim strSQL As String
With rsUser
.AddNew
Call IsEdit(True)
Me.txtuser_name.SetFocus
End With
End Sub
Private Sub IsEdit(blnIsEdit As Boolean)
Dim intNum As Integer
Me.txtuser_name.Enabled = blnIsEdit
Me.txtuser_pass.Enabled = blnIsEdit
For intNum = 0 To 1
Me.CmdAct(intNum).Enabled = blnIsEdit
Next
For intNum = 0 To 5
Me.CmdDep(intNum).Enabled = Not blnIsEdit
Next
If blnIsSQL = True Then
CmdDep(0).Enabled = False
CmdDep(3).Enabled = False
End If
If rsUser.RecordCount = 0 Then
For intNum = 1 To 4
Me.CmdDep(intNum).Enabled = False
Next
End If
End Sub
Private Sub txtuser_name_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Me.txtuser_pass.SetFocus
End Sub