论文首页哲学论文经济论文法学论文教育论文文学论文历史论文理学论文工学论文医学论文管理论文艺术论文 |
Private Sub Command1_Click()
Dim password As String
Dim respond As String
username = Text1.Text
password = Text2.Text
On Error GoTo err1
Adodc1.ConnectionString = conn
Adodc1.RecordSource = "select * from usertab where 用户名=" & "'" & username & "'" & " and " & "密码=" & "'" & password & "'"
Adodc1.Refresh
If Adodc1.Recordset.AbsolutePosition = adPosUnknown Then
respond = MsgBox("用户名或密码错误,请重新输入!", vbOKOnly, "警告")
If respond <> vbOKOnly Then
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
username = ""
password = ""
End If
Else
userright = Adodc1.Recordset.Fields("权限")
Unload frmlogin
frmmain.Show
End If
Exit Sub
err1:
MsgBox "系统配置错误!无法与服务器连接!"
userright = "0"
Unload Me
frmsysset.Show
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
'conn = Frmstart.pconn
conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\his.mdb;Persist Security Info=False"
End Sub
用户修改密码界面设计:
代码设计:
Private Sub Command1_Click()
On Error GoTo err1
username = frmlogin.username
If Text1.Text <> "" And Text2.Text <> "" Then
Adodc1.RecordSource = "select * from usertab where 用户名='" & username & "' and 密码=" & "'" & Text1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.AbsolutePosition = adPosUnknown Then
MsgBox "旧密码错误!"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus (科教作文网http://zw.ΝsΕac.cOM编辑)
Else
Adodc1.Recordset.Fields("密码") = Text2.Text
Adodc1.Recordset.Update
MsgBox "密码修改成功!"
Text1.Text = ""
Text2.Text = ""
End If
Else
MsgBox "新旧密码均不得为空!"
Text1.SetFocus
End If
Exit Sub
err1:
MsgBox "远程服务器连接失败!"
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
On Error GoTo err2
chpwd.Top = (frmmain.Height - chpwd.Height) / 2 - 500
chpwd.Left = (frmmain.Width - chpwd.Width) / 2
Adodc1.ConnectionString = frmlogin.conn
Text1.Text = ""
Text2.Text = ""
Exit Sub
err2:
MsgBox "远程服务器连接失败!"
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmmain.StatusBar1.Panels(2) = "目前没有窗口被激活"
End Sub
Private Sub Form_Activate()
frmmain.StatusBar1.Panels(2) = "活动窗口:" & chpwd.Caption
End Sub
3,关于界面设计:
代码设计:
Private Sub cmdOK_Click()
Unload Me
End Sub
Private Sub Form_Load()
frmAbout.Top = (frmmain.Height - frmAbout.Height) / 2 - 500
frmAbout.Left = (frmmain.Width - frmAbout.Width) / 2
Me.Caption = "关于" & App.Title
lblTitle.Caption = App.Title
End Sub
Public Sub StartSysInfo()
On Error GoTo SysInfoErr
Dim rc As Long
Dim SysInfoPath As String
' 试图从注册表中获得系统信息程序的路径及名称...
If GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFO, gREGVALSYSINFO, SysInfoPath) Then (科教范文网http://fw.NSEAC.com编辑发布)
' 试图仅从注册表中获得系统信息程序的路径...
ElseIf GetKeyValue(HKEY_LOCAL_MACHINE, gREGKEYSYSINFOLOC, gREGVALSYSINFOLOC, SysInfoPath) Then
&nb