⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmadduser.vb

📁 对家庭的开支有一个全面的了解和统计
💻 VB
📖 第 1 页 / 共 2 页
字号:
		Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label4.UseMnemonic = True
		Me.Label4.Visible = True
		Me.Label4.AutoSize = False
		Me.Label4.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label4.Name = "Label4"
		Me.Label3.Text = "用户密码:"
		Me.Label3.Size = New System.Drawing.Size(65, 17)
		Me.Label3.Location = New System.Drawing.Point(8, 99)
		Me.Label3.TabIndex = 9
		Me.Label3.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label3.BackColor = System.Drawing.SystemColors.Control
		Me.Label3.Enabled = True
		Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label3.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label3.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label3.UseMnemonic = True
		Me.Label3.Visible = True
		Me.Label3.AutoSize = False
		Me.Label3.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label3.Name = "Label3"
		Me.Label2.Text = "用户姓名:"
		Me.Label2.Size = New System.Drawing.Size(65, 17)
		Me.Label2.Location = New System.Drawing.Point(8, 53)
		Me.Label2.TabIndex = 8
		Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label2.BackColor = System.Drawing.SystemColors.Control
		Me.Label2.Enabled = True
		Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label2.UseMnemonic = True
		Me.Label2.Visible = True
		Me.Label2.AutoSize = False
		Me.Label2.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label2.Name = "Label2"
		Me.Label1.Text = "用户编号:"
		Me.Label1.Size = New System.Drawing.Size(65, 17)
		Me.Label1.Location = New System.Drawing.Point(8, 8)
		Me.Label1.TabIndex = 0
		Me.Label1.TextAlign = System.Drawing.ContentAlignment.TopLeft
		Me.Label1.BackColor = System.Drawing.SystemColors.Control
		Me.Label1.Enabled = True
		Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
		Me.Label1.Cursor = System.Windows.Forms.Cursors.Default
		Me.Label1.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.Label1.UseMnemonic = True
		Me.Label1.Visible = True
		Me.Label1.AutoSize = False
		Me.Label1.BorderStyle = System.Windows.Forms.BorderStyle.None
		Me.Label1.Name = "Label1"
		Me.Controls.Add(cmdcancel)
		Me.Controls.Add(cmdexit)
		Me.Controls.Add(cmdok)
		Me.Controls.Add(Maskorder)
		Me.Controls.Add(txtrepassword)
		Me.Controls.Add(txtpassword)
		Me.Controls.Add(txtname)
		Me.Controls.Add(Label5)
		Me.Controls.Add(Label4)
		Me.Controls.Add(Label3)
		Me.Controls.Add(Label2)
		Me.Controls.Add(Label1)
		CType(Me.Maskorder, System.ComponentModel.ISupportInitialize).EndInit()
	End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As frmadduser
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmadduser
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmadduser()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Dim db As DAO.Database
	Dim rs As DAO.Recordset
	Dim rsorder As DAO.Recordset
	Dim neworder As Short
	Dim newusename As String
	Dim newpassword1 As String
	Dim newpassword2 As String
	
	Private Sub cmdcancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdcancel.Click
		Maskorder.Focus()
		'Set Maskorder.Text = "10__"
		txtname.Text = ""
		txtpassword.Text = ""
		txtrepassword.Text = ""
	End Sub
	
	Private Sub cmdexit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdexit.Click
		Me.Close()
		frmmain.DefInstance.Show()
	End Sub
	
	Private Sub cmdok_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdok.Click
		'If Len(Maskorder.Text) <> 4 Then
		'  MsgBox "编号长度不够,请输入四位数的编码!", vbOKOnly + vbExclamation, "提示"
		'End If
		
		If Trim(rs.Fields(0).Value) = Trim(Maskorder.CtlText) Then
			MsgBox("编号已经存在,请重新输入新编号!", MsgBoxStyle.OKOnly + MsgBoxStyle.Information, "提示")
			Maskorder.Focus()
			'Set Maskorder.Text = "10__"
			
			txtname.Text = ""
			txtpassword.Text = ""
			txtrepassword.Text = ""
			Exit Sub
		End If
		
		If Trim(rs.Fields(1).Value) = Trim(txtname.Text) Then
			MsgBox("用户名已经存在,请重新输入新用户名!", MsgBoxStyle.OKOnly + MsgBoxStyle.Information, "提示")
			txtname.Focus()
			'  Maskorder.Text = ""
			txtname.Text = ""
			txtpassword.Text = ""
			txtrepassword.Text = ""
			Exit Sub
		End If
		
		neworder = CShort(Trim(Maskorder.CtlText))
		newusename = Trim(txtname.Text)
		newpassword1 = Trim(txtpassword.Text)
		newpassword2 = Trim(txtrepassword.Text)
		
		If txtname.Text = "" Then
			MsgBox("用户名不能为空,请输入!", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "提示")
			Exit Sub
		End If
		If Trim(newpassword1) <> Trim(newpassword2) Then
			MsgBox("两次输入的密码不同,请重新输入", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "密码不同")
			txtpassword.Focus()
			txtpassword.Text = ""
			txtrepassword.Text = ""
			Exit Sub
		End If
		With rs
			.AddNew()
			.Fields("user_Order").Value = neworder
			.Fields("user_name").Value = newusename
			.Fields("user_password").Value = newpassword1
			.Update()
		End With
		MsgBox("你已经成功地添加了该用户!", MsgBoxStyle.OKOnly + MsgBoxStyle.Information, "提示")
		txtname.Text = ""
		txtpassword.Text = ""
		txtrepassword.Text = ""
	End Sub
	
	Private Sub frmadduser_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		db = DAODBEngine_definst.OpenDatabase("d:\data\payout.mdb")
		rs = db.OpenRecordset("user")
		rs.MoveLast()
		Dim order As String
		
		Maskorder.SelText = "100" & (rs.RecordCount) + 1
		
		rs.Index = "user_order"
		Label5.Text = "数据库中已有:" & (rs.RecordCount) & "个用户。"
	End Sub
	
	'UPGRADE_WARNING: Form 事件 frmadduser.Unload 具有新的行为。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2065"”
	Private Sub frmadduser_Closed(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Closed
		frmmain.DefInstance.Show()
	End Sub
	
	
	Private Sub Maskorder_KeyPressEvent(ByVal eventSender As System.Object, ByVal eventArgs As AxMSMask.MaskEdBoxEvents_KeyPressEvent) Handles Maskorder.KeyPressEvent
		If eventArgs.KeyAscii = 13 Then
			System.Windows.Forms.SendKeys.Send("{TAB}")
		End If
	End Sub
	
	Private Sub txtname_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtname.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = 13 Then
			System.Windows.Forms.SendKeys.Send("{TAB}")
		End If
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtpassword_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtpassword.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = 13 Then
			System.Windows.Forms.SendKeys.Send("{TAB}")
		End If
		
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
	
	Private Sub txtrepassword_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles txtrepassword.KeyPress
		Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
		If KeyAscii = 13 Then
			System.Windows.Forms.SendKeys.Send("{TAB}")
		End If
		
		If KeyAscii = 0 Then
			eventArgs.Handled = True
		End If
	End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -