?? frmpassword.vb
字號:
Imports System.Data.SqlClient
Public Class frmpassword
Inherits System.Windows.Forms.Form
Dim blnclose As Boolean
Dim struserid As String
#Region " Windows 窗體設(shè)計器生成的代碼 "
Public Sub New()
MyBase.New()
'該調(diào)用是 Windows 窗體設(shè)計器所必需的。
InitializeComponent()
'在 InitializeComponent() 調(diào)用之后添加任何初始化
End Sub
'窗體重寫 dispose 以清理組件列表。
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
'Windows 窗體設(shè)計器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下過程是 Windows 窗體設(shè)計器所必需的
'可以使用 Windows 窗體設(shè)計器修改此過程。
'不要使用代碼編輯器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents btnok As System.Windows.Forms.Button
Friend WithEvents btncancle As System.Windows.Forms.Button
Friend WithEvents txtuserid As System.Windows.Forms.TextBox
Friend WithEvents txtpassword As System.Windows.Forms.TextBox
Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Friend WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
Friend WithEvents SqlCommand2 As System.Data.SqlClient.SqlCommand
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmpassword))
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.txtuserid = New System.Windows.Forms.TextBox
Me.txtpassword = New System.Windows.Forms.TextBox
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.btnok = New System.Windows.Forms.Button
Me.btncancle = New System.Windows.Forms.Button
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlCommand2 = New System.Data.SqlClient.SqlCommand
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(80, 40)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 23)
Me.Label1.TabIndex = 0
Me.Label1.Text = "用戶名:"
'
'Label2
'
Me.Label2.Font = New System.Drawing.Font("宋體", 10.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(80, 104)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 23)
Me.Label2.TabIndex = 1
Me.Label2.Text = "密 碼:"
'
'txtuserid
'
Me.txtuserid.Location = New System.Drawing.Point(144, 40)
Me.txtuserid.Name = "txtuserid"
Me.txtuserid.Size = New System.Drawing.Size(112, 21)
Me.txtuserid.TabIndex = 2
Me.txtuserid.Text = ""
'
'txtpassword
'
Me.txtpassword.Location = New System.Drawing.Point(144, 104)
Me.txtpassword.Name = "txtpassword"
Me.txtpassword.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtpassword.Size = New System.Drawing.Size(112, 21)
Me.txtpassword.TabIndex = 3
Me.txtpassword.Text = ""
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(64, 128)
Me.PictureBox1.TabIndex = 4
Me.PictureBox1.TabStop = False
'
'btnok
'
Me.btnok.Location = New System.Drawing.Point(96, 144)
Me.btnok.Name = "btnok"
Me.btnok.Size = New System.Drawing.Size(56, 23)
Me.btnok.TabIndex = 5
Me.btnok.Text = "確定"
'
'btncancle
'
Me.btncancle.Location = New System.Drawing.Point(176, 144)
Me.btncancle.Name = "btncancle"
Me.btncancle.Size = New System.Drawing.Size(56, 23)
Me.btncancle.TabIndex = 6
Me.btncancle.Text = "取消"
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "workstation id=4D3A93FBF8BE4E6;packet size=4096;user id=sa;data source=4D3A93FBF8" & _
"BE4E6;persist security info=False;initial catalog=sqlqtgl"
'
'SqlCommand1
'
Me.SqlCommand1.Connection = Me.SqlConnection1
'
'frmpassword
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(360, 198)
Me.Controls.Add(Me.btncancle)
Me.Controls.Add(Me.btnok)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.txtpassword)
Me.Controls.Add(Me.txtuserid)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "frmpassword"
Me.Text = "用戶登錄"
Me.ResumeLayout(False)
End Sub
#End Region
Public Property MyUser() As String
Get
MyUser = struserid
End Get
Set(ByVal Value As String)
struserid = Value
End Set
End Property
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
blnclose = True
End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = Not blnclose
End Sub
Private Sub btnok_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnok.Click
SqlCommand1.CommandText = "select 用戶名 from 用戶 where 用戶名='" & txtuserid.Text & "'and 密碼='" & txtpassword.Text & "'"
SqlConnection1.Open()
struserid = CType(SqlCommand1.ExecuteScalar(), String)
If struserid = "" Then
MessageBox.Show("用戶名或密碼錯誤!", "身份人證失敗", MessageBoxButtons.OK, MessageBoxIcon.Error)
blnclose = False
Else
blnclose = True
struserid = txtuserid.Text
End If
SqlConnection1.Close()
End Sub
Private Sub btncancle_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btncancle.Click
MyUser = ""
blnclose = True
Me.Close()
End Sub
End Class
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -