📄 frm_logic.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_load
BorderStyle = 0 'None
Caption = "登录窗口"
ClientHeight = 2580
ClientLeft = 1590
ClientTop = 1755
ClientWidth = 5475
Icon = "frm_logic.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
Palette = "frm_logic.frx":164A
Picture = "frm_logic.frx":2F6EE
ScaleHeight = 2580
ScaleWidth = 5475
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo1
DataSource = "Adodc1"
Height = 300
Left = 3840
Style = 2 'Dropdown List
TabIndex = 1
Top = 1050
Width = 1450
End
Begin VB.TextBox Text2
Height = 315
IMEMode = 3 'DISABLE
Left = 3825
PasswordChar = "*"
TabIndex = 0
Top = 1485
Width = 1450
End
Begin MSComctlLib.ImageList ImageList1
Left = 165
Top = 2700
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frm_logic.frx":5D792
Key = ""
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 345
Left = 75
Top = 2955
Visible = 0 'False
Width = 2025
_ExtentX = 3572
_ExtentY = 609
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Image Image2
Height = 360
Left = 4185
Picture = "frm_logic.frx":5F46C
Top = 2010
Width = 750
End
Begin VB.Image Image1
Height = 360
Left = 3060
Picture = "frm_logic.frx":602F0
Top = 2010
Width = 750
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码:"
Height = 345
Left = 3225
TabIndex = 3
Top = 1560
Width = 570
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 240
Left = 3135
TabIndex = 2
Top = 1125
Width = 780
End
End
Attribute VB_Name = "frm_load"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem
Dim tim, i As Integer
Dim key, list As String
Private Sub Combo1_Click()
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_power "
End Sub
Private Sub Form_Load()
'自动识别路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_wygl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tab_power "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
For X = 1 To Adodc1.Recordset.RecordCount
Combo1.AddItem Adodc1.Recordset.Fields("操作员姓名").Value
Adodc1.Recordset.MoveNext
Next X
End If
End Sub
Private Sub Image1_Click()
If Trim(Text2.Text) = "" Then
MsgBox "密码不能为空!", , "系统提示"
Exit Sub
End If
If Trim(Combo1.Text) = "" Then
MsgBox "操作员不能为空!", , "系统提示"
Exit Sub
End If
Dim message As String
Adodc1.RecordSource = "select * from tab_power where 操作员姓名 = '" + Trim(Combo1.Text) + "'"
Adodc1.Refresh
With Adodc1.Recordset
If .RecordCount > 0 Then
If Text2.Text = Trim(.Fields("密码")) Then
'Trim 函数返回 Variant (String),其中包含指定字符串的拷贝,没有前导和尾随空白。
Load Frm_main
Frm_main.Show
Unload Me
For i = 2 To 9
If .Fields(i) = -1 Then
Frm_main.mnu1(i).Enabled = False
Else
Frm_main.mnu1(i).Enabled = True
End If
Next i
Else
MsgBox "密码错误,请重新输入密码!", , "系统提示"
tim = tim + 1
If tim = 3 Then
message = MsgBox("密码输入错误,请向系统管理员查询!", 0, "")
'MsgBox 函数在对话框中显示消息,等待用户单击按钮,并返回一个 Integer 告诉用户单击哪一个按钮。
If message = vbOK Then End
End If
Text2.SetFocus
Text2.Text = ""
End If
End If
End With
End Sub
Private Sub Image2_Click()
End
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Image1_Click '按回车键Image1获得焦点
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -