解決方案資源管理器中右鍵菜單,添加,WINDOWS窗體,彈出的對話框中,左欄已安裝的模板中選擇WINDOWS FORMS ,右邊中找到 登錄窗體。添加 。程序會添加一個登錄界面。很方便。你試下。

成都創(chuàng)新互聯(lián)公司自成立以來,一直致力于為企業(yè)提供從網(wǎng)站策劃、網(wǎng)站設計、成都做網(wǎng)站、網(wǎng)站制作、成都外貿(mào)網(wǎng)站建設、電子商務、網(wǎng)站推廣、網(wǎng)站優(yōu)化到為企業(yè)提供個性化軟件開發(fā)等基于互聯(lián)網(wǎng)的全面整合營銷服務。公司擁有豐富的網(wǎng)站建設和互聯(lián)網(wǎng)應用系統(tǒng)開發(fā)管理經(jīng)驗、成熟的應用系統(tǒng)解決方案、優(yōu)秀的網(wǎng)站開發(fā)工程師團隊及專業(yè)的網(wǎng)站設計師團隊。
Private Sub SendBlogTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendBlogTimer.Tick
Dim textboxUserId As HtmlElement
Dim textboxPassword As HtmlElement
Dim buttonSubmit As HtmlElement
textboxUserId = SendBlogBrowser.Document.All("username")'獲取用戶名輸入框
textboxPassword = SendBlogBrowser.Document.All("password")'獲取密碼輸入框
buttonSubmit = SendBlogBrowser.Document.All("btnLogin")'獲取登陸按鈕
textboxUserId.SetAttribute("value","用戶名")'給用戶名輸入框賦值
textboxPassword.SetAttribute("value","密碼")'給密碼框賦值
buttonSubmit.InvokeMember("click")’執(zhí)行登陸按鈕的單擊
End Sub
其中的SendBlogBrowser為WebBrowser控件
Label1.Caption = "融通系統(tǒng)外掛程序"
If Dir(App.Path "/hjw.mdb") "" Then
Set mydata = OpenDatabase(App.Path "\hjw")
Set myrs1 = mydata.OpenRecordset("user", dbOpenTable)
Else
Set mydata = CreateDatabase(App.Path "\hjw", dbLangGeneral, dbVersion40)
mydata.Execute "create table ku (建立日期 text(100),庫名 text(100),功能 text(100))"
mydata.Execute "create table system (店號 integer,建立日期 text(100),文件路徑 text(100),軟件版本 text(100),路徑1 text(50),路徑2 text(50),路徑3 text(50),路徑4 text(50))"
kuname = "system"
kugn = "文件信息"
Me.showlist1
mydata.Execute "create table user (user text(50),passwd text(50),name text(50),quanx integer)"
kuname = "user"
kugn = "用戶信息"
Me.showlist1
Private Sub cmdOK_Click()
txtUserName.SetFocus
If Trim(txtUserName.Text = "") Then
MsgBox "沒有這個用戶,請重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
sql = "select * from user where user = '" txtUserName.Text "'"
'Debug.Print sql
'Set mrc = ExecuteSQL(sql, MsgText)
Set myrs2 = mydata.OpenRecordset(sql)
If myrs2.EOF = True Then
MsgBox "沒有這個用戶,請重新輸入用戶名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(myrs2.Fields(1)) = Trim(txtPassword.Text) Then
UserName = myrs2.Fields(2)
myrs2.Close
Me.Hide
' UserName = Trim(txtUserName.Text)
'Debug.Print UserName
MDIform1.Show
Else
MsgBox "輸入密碼不正確,請重新輸入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
End Sub
建個模塊, Dim varcnn As OleDb.OleDbConnection ReadOnly Property cnn() As OleDb.OleDbConnection
Get
If varcnn Is Nothing OrElse varcnn.State ConnectionState.Open Then Dim cnstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""" My.Application.Info.DirectoryPath "\Contact.mdb"";Persist Security Info=True"
varcnn = New OleDbConnection(cnstr)
varcnn.Open()
End If
Return varcnn
End Get
登錄窗體,新建一個就行了。代碼Public Class LoginForm1
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Using cmd As New OleDb.OleDbCommand("select password from tbuser where userid =?", cnn)
cmd.Parameters.Add("?", OleDbType.VarChar).Value = Me.UsernameTextBox.Text
Dim obj As Object = cmd.ExecuteScalar
If (Not IsDBNull(obj)) AndAlso (obj IsNot Nothing) AndAlso obj = PasswordTextBox.Text Then
Me.DialogResult = Windows.Forms.DialogResult.OK
Else MessageBox.Show("密碼不正確!") Return
End If
End Using Me.Close()
End Sub Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.DialogResult = Windows.Forms.DialogResult.Cancel
Me.Close()
End SubEnd Class 項目屬性里點查看應用程序事件,寫代碼Namespace My ' 以下事件可用于 MyApplication:
'
' Startup: 應用程序啟動時在創(chuàng)建啟動窗體之前引發(fā)。
' Shutdown: 在關(guān)閉所有應用程序窗體后引發(fā)。如果應用程序異常終止,則不會引發(fā)此事件。
' UnhandledException: 在應用程序遇到未處理的異常時引發(fā)。
' StartupNextInstance: 在啟動單實例應用程序且應用程序已處于活動狀態(tài)時引發(fā)。
' NetworkAvailabilityChanged: 在連接或斷開網(wǎng)絡連接時引發(fā)。
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
Dim f As New LoginForm1
If Not f.ShowDialog = DialogResult.OK Then
End
End If
End Sub End ClassEnd Namespace
你測試一下吧。
網(wǎng)頁題目:vb.net制作登錄框,vb登錄對話框
文章分享:http://chinadenli.net/article42/dsiodhc.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導航、網(wǎng)站策劃、響應式網(wǎng)站、網(wǎng)頁設計公司、移動網(wǎng)站建設、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)