📄 frmaddmanager.vb
字号:
Public Class FrmAddManager
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
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 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents BtOk As System.Windows.Forms.Button
Friend WithEvents BtExit As System.Windows.Forms.Button
Friend WithEvents TxtName As System.Windows.Forms.TextBox
Friend WithEvents TxtPassword As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.BtOk = New System.Windows.Forms.Button
Me.BtExit = New System.Windows.Forms.Button
Me.TxtName = New System.Windows.Forms.TextBox
Me.TxtPassword = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 72)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 0
Me.Label1.Text = "用户名"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(16, 112)
Me.Label2.Name = "Label2"
Me.Label2.TabIndex = 1
Me.Label2.Text = "密码"
'
'BtOk
'
Me.BtOk.Location = New System.Drawing.Point(40, 184)
Me.BtOk.Name = "BtOk"
Me.BtOk.TabIndex = 2
Me.BtOk.Text = "确认"
'
'BtExit
'
Me.BtExit.Location = New System.Drawing.Point(144, 184)
Me.BtExit.Name = "BtExit"
Me.BtExit.TabIndex = 3
Me.BtExit.Text = "取消"
'
'TxtName
'
Me.TxtName.Location = New System.Drawing.Point(136, 72)
Me.TxtName.Name = "TxtName"
Me.TxtName.TabIndex = 4
Me.TxtName.Text = " "
'
'TxtPassword
'
Me.TxtPassword.Location = New System.Drawing.Point(136, 112)
Me.TxtPassword.Name = "TxtPassword"
Me.TxtPassword.TabIndex = 5
Me.TxtPassword.Text = " "
'
'FrmAddManager
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.TxtPassword)
Me.Controls.Add(Me.TxtName)
Me.Controls.Add(Me.BtExit)
Me.Controls.Add(Me.BtOk)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "FrmAddManager"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "添加管理员"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub BtOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtOk.Click
Dim dbstr As String
dbstr = "select * from tbManager where Name='" & TxtName.Text & "' or Pwd='" & TxtPassword.Text & "'"
Myrec = Mydb.OpenRecordset(dbstr, DAO.RecordsetTypeEnum.dbOpenDynaset)
If TxtName.Text = "" Or TxtPassword.Text = "" Then
MsgBox("请输入完整信息。", MsgBoxStyle.OKOnly, "信息框")
ElseIf Myrec.EOF = True Then
Myrec.AddNew()
Myrec.Fields(0).Value = TxtName.Text
Myrec.Fields(1).Value = TxtPassword.Text
Myrec.Update()
TxtName.Text = ""
TxtPassword.Text = ""
MsgBox("恭喜你,添加用户成功!", , Me.Text)
Else
MsgBox("这个管理员已经存在了,请重新输入.")
TxtName.Text = ""
TxtPassword.Text = ""
End If
End Sub
Private Sub BtExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtExit.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -