?? frmadd.frm
字號(hào):
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmManagement
BorderStyle = 4 'Fixed ToolWindow
Caption = "用戶管理"
ClientHeight = 5190
ClientLeft = 3210
ClientTop = 2475
ClientWidth = 7680
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5190
ScaleWidth = 7680
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 3015
Left = 1200
TabIndex = 1
Top = 1200
Width = 5415
Begin VB.PictureBox Pic1
Height = 255
Left = 5040
ScaleHeight = 195
ScaleWidth = 195
TabIndex = 18
Top = 1440
Width = 255
End
Begin VB.TextBox Text4
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
MaxLength = 50
PasswordChar = "*"
TabIndex = 17
Top = 1680
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 2280
MaxLength = 50
TabIndex = 6
Top = 360
Width = 2295
End
Begin VB.TextBox Text3
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
MaxLength = 50
PasswordChar = "*"
TabIndex = 5
Top = 1080
Width = 2295
End
Begin VB.CommandButton Command1
Height = 495
Left = 360
Picture = "FrmAdd.frx":0000
Style = 1 'Graphical
TabIndex = 4
Top = 2280
Width = 1215
End
Begin VB.CommandButton Command2
Height = 495
Left = 3720
Picture = "FrmAdd.frx":0F69
Style = 1 'Graphical
TabIndex = 3
Top = 2280
Width = 1215
End
Begin VB.CommandButton Command3
Height = 495
Left = 2040
Picture = "FrmAdd.frx":1EE4
Style = 1 'Graphical
TabIndex = 2
Top = 2280
Width = 1215
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "確認(rèn)密碼:"
BeginProperty Font
Name = "楷體_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 360
TabIndex = 16
Top = 1680
Width = 1695
End
Begin VB.Label mm
BackStyle = 0 'Transparent
Caption = "密 碼:"
BeginProperty Font
Name = "楷體_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 360
TabIndex = 8
Top = 960
Width = 1815
End
Begin VB.Label yhm
BackStyle = 0 'Transparent
Caption = "用 戶 名:"
BeginProperty Font
Name = "楷體_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 360
TabIndex = 7
Top = 360
Width = 1695
End
End
Begin VB.Frame Frame2
Height = 2895
Left = 1200
TabIndex = 9
Top = 1080
Width = 5295
Begin VB.CommandButton Command6
Height = 495
Left = 3600
Picture = "FrmAdd.frx":2FB9
Style = 1 'Graphical
TabIndex = 15
Top = 2280
Width = 1095
End
Begin VB.CommandButton Command5
Height = 495
Left = 2100
Picture = "FrmAdd.frx":4076
Style = 1 'Graphical
TabIndex = 14
Top = 2280
Width = 1095
End
Begin VB.CommandButton Command4
Height = 495
Left = 600
Picture = "FrmAdd.frx":5167
Style = 1 'Graphical
TabIndex = 13
Top = 2280
Width = 1095
End
Begin VB.TextBox Text2
Height = 390
IMEMode = 3 'DISABLE
Left = 3240
MaxLength = 50
TabIndex = 12
Top = 1800
Width = 1215
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1575
Left = 120
TabIndex = 10
Top = 240
Width = 5055
_ExtentX = 8916
_ExtentY = 2778
_Version = 393216
BackColor = 16777215
Enabled = -1 'True
HeadLines = 1
RowHeight = 15
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
ColumnCount = 2
BeginProperty Column00
DataField = ""
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 = ""
Caption = ""
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
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "請(qǐng)輸入查詢的用戶名:"
ForeColor = &H00FF0000&
Height = 270
Left = 720
TabIndex = 11
Top = 1920
Width = 2055
End
End
Begin MSComctlLib.TabStrip TabStrip1
Height = 3615
Left = 960
TabIndex = 0
Top = 720
Width = 5895
_ExtentX = 10398
_ExtentY = 6376
_Version = 393216
BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628}
NumTabs = 2
BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "添加/刪除用戶"
Key = "yhgl"
ImageVarType = 2
EndProperty
BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628}
Caption = "瀏覽用戶"
Key = "llyh"
ImageVarType = 2
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmManagement"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim WithEvents rs As Recordset
Attribute rs.VB_VarHelpID = -1
Dim i As Integer
Dim j As Integer
Private Sub BackG(f As Form, pic As PictureBox)
For i = 0 To (f.ScaleWidth \ pic.Width)
For j = 0 To (f.ScaleHeight \ pic.Height)
PaintPicture pic.Picture, i * pic.Width, j * pic.Height
Next
Next
End Sub
Private Sub Form_Load()
Frame1.Visible = True
Frame2.Visible = False
Me.AutoRedraw = True
Pic1.Visible = False
Pic1.BorderStyle = 0
Pic1.AutoSize = True
Pic1.Picture = LoadPicture(App.Path + "\1.jpg")
BackG Me, Pic1
End Sub
Private Sub Form_resize()
BackG Me, Pic1
End Sub
Private Sub Command1_Click()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\db1.mdb;" & "Persist Security Info=False;"
Set rs = New Recordset
rs.Open "select*from 用戶", db, adOpenStatic, adLockOptimistic
If Text1 = "" Then
MsgBox "用戶名不能為空", vbExclamation, "警告"
Text1.SetFocus
Exit Sub
End If
rs.MoveFirst
Do While rs.EOF = False
If rs("user_name") = Text1 Then
MsgBox "用戶名已存在,請(qǐng)重新輸入", vbExclamation, "警告"
Text1 = ""
Text3 = ""
Text4 = ""
Text1.SetFocus
Exit Sub
End If
rs.MoveNext
Loop
If Trim(Text3.Text) <> Trim(Text4.Text) Then
MsgBox "兩次輸入密碼不一樣,請(qǐng)確認(rèn)", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Text1 = ""
Text3 = ""
Text4 = ""
Exit Sub
End If
rs.AddNew
rs("user_name") = Text1
rs("user_psw") = Text3
rs.Update
MsgBox "添加用戶成功,請(qǐng)記住你的口令和密碼", vbInformation, "提示"
Text1 = ""
Text3 = ""
Text4 = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\db1.mdb;" & "Persist Security Info=False;"
Set rs = New Recordset
rs.Open "select *from 用戶 where user_name='" & Text1.Text & "'", db, adOpenStatic, adLockOptimistic
If (rs.EOF And rs.BOF) Then
MsgBox "用戶不存在", vbCritical, "刪除用戶"
Exit Sub
ElseIf Not (rs.BOF And rs.EOF) Then
Dim response, Msg, Style, Title, Help, Ctxt
Msg = "你確實(shí)要?jiǎng)h除此用戶嗎?你將徹底刪除此用戶!" ' 定義信息。
Style = vbOKCancel ' 定義按鈕。
Title = "刪除用戶" ' 定義標(biāo)題。
Ctxt = 1000 ' 定義標(biāo)題
' 上下文。
' 顯示信息
response = MsgBox(Msg, Style, Title, Help, Ctxt)
If response = vbCancel Then
Exit Sub
ElseIf response = vbOK Then
rs.Delete
rs.Update
MsgBox "用戶刪除成功!", vbInformation, "完成"
rs.Close
End If
End If
Text1.Text = ""
Text3 = ""
Text4 = ""
End Sub
Private Sub Command4_Click()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\db1.mdb;" & "Persist Security Info=False;"
Set rs = New Recordset
rs.Open "select * from 用戶 where user_name='" & Text2 & "'", db, adOpenStatic, adLockOptimistic
If rs.EOF = True Then
MsgBox "用戶名不存在", vbInformation + vbOKCancel, "警告"
Else
Set DataGrid1.DataSource = rs
End If
Text2.Text = ""
End Sub
Private Sub Command5_Click()
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\db1.mdb;" & "Persist Security Info=False;"
Set rs = New Recordset
rs.Open "select * from 用戶", db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = rs
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub TabStrip1_Click()
Select Case TabStrip1.SelectedItem.Key
Case "yhgl"
Frame1.Visible = True
Frame2.Visible = False
Case "llyh"
Frame1.Visible = False
Frame2.Visible = True
End Select
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -