Private Sub Command1_Click()
中方ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
Static i As Integer
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "請輸入用戶名和密碼", vbOKOnly, "提示"
Text1.SetFocus
Exit Sub
End If
If Text1.Text = "admin" And Text2.Text = "admin" Then
MsgBox "用戶名密碼正確", vbOKOnly, "提示"
i = 0
Else
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
If i 3 Then
MsgBox "用戶名或密碼錯誤,請重新輸入", vbOKOnly, "提示"
i = i + 1
End If
If i = 3 Then
MsgBox "輸入3次錯誤用戶名或密碼,程序?qū)⑼顺?, vbOKOnly, "提示"
Unload Me
End If
End If
End Sub
Private Sub Form_Load()
Label1.Caption = "用戶名"
Label2.Caption = "密 碼"
Text1.Text = ""
Text2.Text = ""
Text2.PasswordChar = "*"
Command1.Caption = "確定"
End Sub
你去學習如何建立窗體,如何調(diào)出窗體,隱藏窗體,等等,就可以了。如果這個些不會,你就沒法做成注冊的。
創(chuàng)建完相應(yīng)的用戶名,密碼控件之后,輸入以下代碼:
Imports System.Data.OleDb
Public Class Form1
Private Sub cmdok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdok.Click
Dim m_username As String
Dim m_userpwd As String
Dim cmd_result As MsgBoxResult
Dim m_da As New OleDbDataAdapter
Dim m_ds As New DataSet
Dim m_command As New OleDbCommand
Dim strsql As String
m_username = txtusername.Text
m_userpwd = txtuserpwd.Text
strsql = " select * from user_info where username='" m_username "' and userpwd='" m_userpwd "'"
OleDbConnection1.Open()
m_command.CommandType = CommandType.Text
m_command.CommandText = strsql
m_command.Connection = OleDbConnection1
m_da.SelectCommand = m_command
m_da.Fill(m_ds, "user_info")
If m_ds.Tables("user_info").Rows.Count 0 Then
cmd_result = MsgBox("歡迎登錄", MsgBoxStyle.OKOnly, "提示")
Else
MsgBox("登錄失敗,請確認用戶名和密碼")
End If
End Sub
End Class
用格式轉(zhuǎn)換器(格式工廠)把ico格式轉(zhuǎn)換成其他可識別的格式
然后在添加
下一步(你的意思是要在界面設(shè)計中 往窗體上添加工具欄嗎?)
工具箱中 ---- 菜單和工具欄 ----- MenuStrip
窗體上方出現(xiàn) '請再次鍵入'(vs2010中) 的框框 點一下就可以放"打開"什么的了
右面屬性中找到Image屬性.可以更改你自己的圖片了.
知道了嗎?
還有疑問你就追問 ````赫赫
1.首先添加2個label控件,一個caption為用戶名,一個為密碼然后分別在2個label控件后面添加一個text控件,
2.將text的text屬性設(shè)置為空再添加2個button按鈕,一個名為登陸,一個名為取消簡要代碼如下:
private sub text2_change() sswordchar="*"end subprivate sub button1_click()if text1.text="text" and text2.text="123456" then '這里寫驗證代碼... ?'通過驗證后要干么elsemsgbox("用戶名或者密碼不正確!")end if end subprivate sub button2_click()endend sub