📄 register.vb
字号:
Public Class Register
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 TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Register))
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(280, 26)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(152, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(280, 60)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox2.Size = New System.Drawing.Size(152, 21)
Me.TextBox2.TabIndex = 3
Me.TextBox2.Text = ""
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(280, 96)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox3.Size = New System.Drawing.Size(152, 21)
Me.TextBox3.TabIndex = 5
Me.TextBox3.Text = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Button1.Location = New System.Drawing.Point(192, 200)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(88, 24)
Me.Button1.TabIndex = 6
Me.Button1.Text = "注册"
'
'Button2
'
Me.Button2.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button2.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Button2.Location = New System.Drawing.Point(288, 200)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(88, 24)
Me.Button2.TabIndex = 7
Me.Button2.Text = "清空"
'
'Button3
'
Me.Button3.BackColor = System.Drawing.SystemColors.ActiveCaptionText
Me.Button3.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Button3.Location = New System.Drawing.Point(384, 200)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(88, 24)
Me.Button3.TabIndex = 8
Me.Button3.Text = "退出"
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(280, 132)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.TextBox4.Size = New System.Drawing.Size(152, 21)
Me.TextBox4.TabIndex = 10
Me.TextBox4.Text = ""
'
'Register
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
Me.ClientSize = New System.Drawing.Size(488, 253)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MaximumSize = New System.Drawing.Size(496, 280)
Me.MinimumSize = New System.Drawing.Size(496, 280)
Me.Name = "Register"
Me.Text = "新用户注册"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If TextBox1.Text = "" Then
MsgBox("用户名不能为空")
Exit Sub
End If
If TextBox4.Text = "" Then
MsgBox("请输入您的真实姓名")
Exit Sub
End If
If TextBox2.Text = "" And TextBox3.Text = "" Then
MsgBox("为了您的个人信息安全,您必须设置密码!")
End If
If Not TextBox2.Text = TextBox3.Text Then
MsgBox("2次输入的密码不一致!")
TextBox2.Text = ""
TextBox3.Text = ""
Exit Sub
End If
Dim str As String
Dim i As Integer
Dim ds As DataSet
ds = search.query("select * from T_User where C_UserId = '" & TextBox1.Text & "'")
If ds.Tables(0).Rows.Count <> 0 Then
MsgBox("用户名已经被使用,请重新选择您的用户名!")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Exit Sub
End If
search.insert("insert into T_User values('" & TextBox1.Text & "','" & TextBox2.Text & "','user','" & TextBox4.Text & "')")
MsgBox(" 恭喜您,注册成功! " & (Chr(10)) & " 欢迎 " & TextBox1.Text & " 来到Good Edu 学生信息管理系统 ")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -