?? frm_xtdl.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_xtdl
Caption = "系統登錄"
ClientHeight = 3015
ClientLeft = 4260
ClientTop = 3345
ClientWidth = 4860
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_xtdl.frx":0000
ScaleHeight = 3015
ScaleWidth = 4860
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
IMEMode = 3 'DISABLE
Left = 3270
PasswordChar = "*"
TabIndex = 5
Top = 2070
Width = 1275
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 300
Left = 1200
TabIndex = 4
Text = "mr"
Top = 2070
Width = 1290
End
Begin MSComctlLib.ImageList ImageList1
Left = 120
Top = 3150
_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_xtdl.frx":B036
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 1725
Left = 165
TabIndex = 0
Top = 180
Width = 4515
_ExtentX = 7964
_ExtentY = 3043
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 0
NumItems = 0
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 1005
Top = 3075
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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.CommandButton Command1
Caption = "確定"
Height = 320
Left = 2565
TabIndex = 1
Top = 2520
Width = 875
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 320
Left = 3615
TabIndex = 2
Top = 2520
Width = 875
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
ForeColor = &H00C000C0&
Height = 225
Left = 120
TabIndex = 3
Top = 2565
Width = 2340
End
End
Attribute VB_Name = "frm_xtdl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem '定義一個ListItem對象
Dim a
Dim key As String '定義字符串變量
'*** 用戶登錄按鈕的事件代碼 ***
Private Sub Command1_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '運用API函數SetWindowPos,來實現取消窗體置前的功能
On Error Resume Next
Dim MPassword As String
If Text2.Text = "mr" And Text1.Text = "mingrisoft" Then '判斷是否使用的是超級口令登錄
frm_main.StatusBar1.Panels.Item(2).Text = "當前操作員: mr"
Name1 = Text2.Text
Unload Me
frm_main.Show
Else
Adodc1.RecordSource = "select * from tb_enter where M_Name ='" & Text2.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("M_Password")
If Text1.Text = MPassword Then '判斷數據的密碼是否正確
frm_main.StatusBar1.Panels.Item(2).Text = "當前操作員: " + Adodc1.Recordset.Fields("M_Name")
Name1 = Text2.Text
frm_main.Show
'添加登錄日志
Open (App.Path & "\系統日志.ini") For Input As #1
Do While Not EOF(1)
Line Input #1, Intext
TStr = TStr + Intext + Chr(13) + Chr(10)
Loop
Close #1
TStr = TStr + " " + Name1 + " " + Format(Now, "yyyy-mm-dd hh:mm:ss") + " " + "系統登錄" + Chr(13) + Chr(10)
Open (App.Path & "\系統日志.ini") For Output As #1
Print #1, TStr
Close #1
Unload Me
Else
MsgBox "密碼不正確,請您確認后重新輸入", , "庫存管理系統"
Text1.Text = ""
Text1.SetFocus
End If
Else
MsgBox "對不起 沒有此用戶的信息", , "庫存管理系統"
Text2.Text = ""
Text1.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Call WHScreen
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '運用API函數SetWindowPos,來實現使窗體置前的功能
'使用代碼連接數據庫與數據表
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_enter"
Adodc1.Refresh
Adodc1.RecordSource = "select * from tb_enter"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
ListView1.Enabled = True
ListView1.ListItems.Clear
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False '將操作員信息添加到ListView控件當中
key = Adodc1.Recordset.Fields("M_Name")
Set itmX = ListView1.ListItems.Add(, , key, 1)
Adodc1.Recordset.MoveNext
Loop
Else
ListView1.Enabled = False
End If
ScreenCenter
If TWidth <= 800 Or THeigth <= 600 Then
Exit Sub
Else
ChangeScreen '調整屏幕分辨率
ScreenCenter
End If
End Sub
Private Sub ListView1_Click()
Text2.Text = ListView1.SelectedItem
Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Text2.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Label3.Caption = "所選操作員的職務: " & Adodc1.Recordset.Fields(2)
Text1.SetFocus
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Command1_Click
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1.SetFocus
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub ScreenCenter()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub ChangeScreen() '改變屏幕分辨率函數
' MsgBox "您桌面的分辨率并不是800*600,建議您將桌面的分辨率調整成800*600之后,再運行此程序!", 64, "提示信息"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -