📄 form2.vb
字号:
' Human Resources Management System (HRMS)
'
' Programmed by: Nura Tijjani Abubakar (ntagrafix@yahoo.com)
' Submitted to: Mr. Ravindran Kanapathy
'
' Oxford Brookes University (OBU)
' Final Year Project (November, 2007)
Imports System.Data
Imports System.Data.OleDb
Public Class Form2
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form2))
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(30, 17)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Username:"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(30, 41)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(64, 16)
Me.Label2.TabIndex = 0
Me.Label2.Text = "Password:"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'TextBox1
'
Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox1.Location = New System.Drawing.Point(94, 15)
Me.TextBox1.MaxLength = 15
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(103, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox2.Location = New System.Drawing.Point(94, 39)
Me.TextBox2.MaxLength = 20
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox2.Size = New System.Drawing.Size(103, 20)
Me.TextBox2.TabIndex = 2
Me.TextBox2.Text = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.Color.Chocolate
Me.Button1.Enabled = False
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.ForeColor = System.Drawing.Color.Black
Me.Button1.Location = New System.Drawing.Point(41, 71)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(64, 24)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Login"
'
'Button2
'
Me.Button2.BackColor = System.Drawing.Color.Chocolate
Me.Button2.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button2.ForeColor = System.Drawing.Color.Black
Me.Button2.Location = New System.Drawing.Point(121, 71)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(64, 24)
Me.Button2.TabIndex = 4
Me.Button2.Text = "Cancel"
'
'Form2
'
Me.AcceptButton = Me.Button1
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.Control
Me.CancelButton = Me.Button2
Me.ClientSize = New System.Drawing.Size(226, 111)
Me.ControlBox = False
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ForeColor = System.Drawing.SystemColors.ControlText
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Form2"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = " HRMS: System Admin"
Me.ResumeLayout(False)
End Sub
#End Region
Public sConn As OleDbConnection
Dim lDS As DataSet = New DataSet
Dim lDA As OleDbDataAdapter = New OleDbDataAdapter
Dim lDR As DataRow
Private Sub TextboxChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
If TextBox1.Text <> "" And TextBox2.Text <> "" Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\EIS.mdb;Persist Security Info=False")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
sConn.Open()
lDA.SelectCommand = New OleDbCommand("SELECT * FROM tblSysLogin WHERE usr_name='" & TextBox1.Text.ToString & "' and usr_pass='" & TextBox2.Text & "'", sConn)
lDS.Clear()
lDA.Fill(lDS)
If lDS.Tables(0).Rows.Count > 0 Then
Dim fx As New Form3
bExitApplication = False
Me.Close()
fx.Show()
Else
MsgBox("Sorry, you do NOT have Administrative permission. Please contact the System Administrator.", MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly, "Access Denied")
TextBox1.Focus()
End If
lDR = Nothing
lDS.Dispose()
lDA.Dispose()
sConn.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim f As New Form1
bExitApplication = False
Me.Close()
f.Show()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -