以下是 VB.NET 中实现账号密码登录和注册的示例代码:
登录代码:
```
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
Dim userName As String = txtUserName.Text.Trim()
Dim password As String = txtPassword.Text.Trim()
If userName = "" OrElse password = "" Then
MsgBox("请输入用户名和密码!")
Return
End If
'TODO: 验证用户名和密码是否正确,此处只是简单的示例代码
If userName = "admin" AndAlso password = "123456" Then
MsgBox("登录成功!")
'TODO: 跳转到主界面或其他操作
Else
MsgBox("用户名或密码错误!")
End If
End Sub
```
注册代码:
```
Private Sub btnRegister_Click(sender As Object, e As EventArgs) Handles btnRegister.Click
Dim userName As String =