📄 addmod.vb
字号:
Public Class AddMod
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 Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents txtRemark As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtCancel As System.Windows.Forms.Button
Friend WithEvents cmbGroup As System.Windows.Forms.ComboBox
Friend WithEvents txtName As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.txtName = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.cmbGroup = New System.Windows.Forms.ComboBox
Me.txtRemark = New System.Windows.Forms.TextBox
Me.Label3 = New System.Windows.Forms.Label
Me.txtCancel = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button1.Location = New System.Drawing.Point(32, 208)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "确 定"
'
'txtName
'
Me.txtName.Location = New System.Drawing.Point(120, 48)
Me.txtName.MaxLength = 10
Me.txtName.Name = "txtName"
Me.txtName.TabIndex = 1
Me.txtName.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(40, 56)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(56, 16)
Me.Label1.TabIndex = 2
Me.Label1.Text = "用户名:"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(40, 96)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 16)
Me.Label2.TabIndex = 3
Me.Label2.Text = "用户类别:"
'
'cmbGroup
'
Me.cmbGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cmbGroup.Location = New System.Drawing.Point(120, 88)
Me.cmbGroup.Name = "cmbGroup"
Me.cmbGroup.Size = New System.Drawing.Size(104, 20)
Me.cmbGroup.TabIndex = 4
'
'txtRemark
'
Me.txtRemark.Location = New System.Drawing.Point(120, 128)
Me.txtRemark.MaxLength = 50
Me.txtRemark.Multiline = True
Me.txtRemark.Name = "txtRemark"
Me.txtRemark.Size = New System.Drawing.Size(144, 64)
Me.txtRemark.TabIndex = 5
Me.txtRemark.Text = ""
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(40, 136)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(48, 16)
Me.Label3.TabIndex = 6
Me.Label3.Text = "备注:"
'
'txtCancel
'
Me.txtCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.txtCancel.Location = New System.Drawing.Point(136, 208)
Me.txtCancel.Name = "txtCancel"
Me.txtCancel.TabIndex = 7
Me.txtCancel.Text = "取 消"
'
'AddMod
'
Me.AcceptButton = Me.Button1
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.CancelButton = Me.txtCancel
Me.ClientSize = New System.Drawing.Size(280, 246)
Me.Controls.Add(Me.txtCancel)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.txtRemark)
Me.Controls.Add(Me.cmbGroup)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtName)
Me.Controls.Add(Me.Button1)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "AddMod"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "用户信息"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub AddMod_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Users.UsersGroup(cmbGroup)
If ClickAdd = True Then
cmbGroup.Text = cmbGroup.Items.Item(0)
Me.Text = "添加信息"
Else
Me.Text = "修改信息"
txtName.Text = Trim(Temp(1))
cmbGroup.Text = Trim(Temp(2))
txtRemark.Text = Trim(Temp(3))
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtName.Text = "" Then
MessageBox.Show("用户名不能为空", "错误")
Exit Sub
Else
If ClickAdd = True Then
Dim info(4) As String
info(0) = txtName.Text.Trim
info(1) = cmbGroup.SelectedIndex + 1
info(2) = "111111"
info(3) = txtRemark.Text.Trim
Users.AddUsers(info)
MessageBox.Show("添加用户成功!初始密码为111111", "添加成功")
Me.Close()
Else
Dim info(3) As String
info(0) = txtName.Text.Trim
info(1) = cmbGroup.SelectedIndex + 1
info(2) = txtRemark.Text.Trim
Users.ModUsers(info)
MessageBox.Show("修改成功!", "修改成功")
Me.Close()
End If
End If
End Sub
Private Sub txtCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCancel.Click
Me.Close()
End Sub
Private Sub AddMod_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -