frmfamilyedit.vb

来自「人事管理系统 在使用源程序前」· VB 代码 · 共 46 行

VB
46
字号

Class FrmFamilyEdit
    Inherits System.Windows.Forms.Form
    Public Modify As Boolean '插入=false,修改=true
    Public VarEmpId As Integer
    Public OriId As Short

    Private Sub Cmd_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd_Cancel.Click
        Me.Close()
    End Sub

    Private Sub txtAge_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAge.KeyPress
        Dim KeyAscii As Short = Asc(e.KeyChar)
        If In_Int(KeyAscii) = False Then
            KeyAscii = 0
        End If
        e.KeyChar = Chr(KeyAscii)
        If KeyAscii = 0 Then
            e.Handled = True
        End If
    End Sub


    Private Sub BtnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOK.Click
        If Len(Trim(txtName.Text)) = 0 Then
            MsgBox("请输入姓名")
            txtName.Focus()
            txtName.SelectionStart = 0
            txtName.SelectionLength = Len(txtName.Text)
            Exit Sub
        End If
        With MyFam
            .Name = Trim(txtName.Text)
            .Sex = Trim(ComboSex.Text)
            .Age = Val(txtAge.Text)
            .Relationship = Trim(txtRelation.Text)
            .WorkingOrg = Trim(txtWorkingOrg.Text)
            If Modify = False Then
                .Insert((VarEmpId))
            Else
                .Update(VarEmpId, OriId)
            End If
        End With
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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