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

📄 frmclient.vb

📁 humar resourse management
💻 VB
📖 第 1 页 / 共 5 页
字号:
        '
        Me.Label11.BackColor = System.Drawing.SystemColors.Control
        Me.Label11.Font = New System.Drawing.Font("Century Gothic", 15.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label11.ForeColor = System.Drawing.Color.Black
        Me.Label11.Location = New System.Drawing.Point(327, 17)
        Me.Label11.Name = "Label11"
        Me.Label11.Size = New System.Drawing.Size(153, 24)
        Me.Label11.TabIndex = 28
        Me.Label11.Text = "CLIENT DETAILS"
        '
        'frmClient
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 13)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(806, 490)
        Me.Controls.Add(Me.Label11)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnDelete)
        Me.Controls.Add(Me.dgClient)
        Me.Controls.Add(Me.pnlDetails)
        Me.Controls.Add(Me.btnClose)
        Me.Controls.Add(Me.btnSave)
        Me.Controls.Add(Me.btnEdit)
        Me.Controls.Add(Me.btnNew)
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "frmClient"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "     Client Details"
        Me.TransparencyKey = System.Drawing.Color.White
        Me.pnlDetails.ResumeLayout(False)
        CType(Me.DsClient1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.dgClient, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Client_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        DA.Fill(DsClient1, "Client")
        txtName.ReadOnly = True
        btnSave.Enabled = False
        btnCancel.Enabled = False
        btnEdit.Enabled = False
        btnDelete.Enabled = False
    End Sub
    Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
        Operation = "NEW"
        Clear()
        ROFalse()
        btnEdit.Enabled = False
        btnDelete.Enabled = False
        btnNew.Enabled = False
        btnSave.Enabled = True
        btnCancel.Enabled = True
        dgClient.Enabled = False
    End Sub
    Private Sub btnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEdit.Click
        Operation = "EDIT"
        ROFalse()
        btnEdit.Enabled = False
        btnNew.Enabled = False
        btnCancel.Enabled = True
        btnSave.Enabled = True
        btnDelete.Enabled = False
        dgClient.Enabled = False
    End Sub
    Private Sub dgClient_CurrentCellChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgClient.CurrentCellChanged
        btnEdit.Enabled = True
        btnDelete.Enabled = True
        cid = Val(dgClient.Item(dgClient.CurrentRowIndex(), 0).ToString())
    End Sub
    Dim TmpTable As DataTable
    Dim TmpRow As DataRow
    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        oDetails = New Details
        Store()
        Dim iStatus As Boolean = oValidation.Field(oDetails, "Agent")
        If iStatus Then
            TmpTable = DsClient1.Tables("Client")
            If Operation = "NEW" Then
                TmpRow = TmpTable.NewRow()
                TmpRow("Name") = txtName.Text
                TmpRow("Contact") = txtContact.Text
                TmpRow("Address") = txtAddress.Text
                TmpRow("Country") = txtCountry.Text
                TmpRow("City") = txtCity.Text
                TmpRow("Pincode") = txtPincode.Text
                TmpRow("Phone") = txtPhone.Text
                TmpRow("Mobile") = txtMobile.Text
                TmpRow("Fax") = txtFax.Text
                TmpRow("Email") = txtEmail.Text
                TmpTable.Rows.Add(TmpRow)
            Else
                If Operation = "EDIT" Then
                    TmpRow = TmpTable.Rows.Find(cid)
                    TmpRow.BeginEdit()
                    TmpRow("Name") = txtName.Text
                    TmpRow("Contact") = txtContact.Text
                    TmpRow("Address") = txtAddress.Text
                    TmpRow("City") = txtCity.Text
                    TmpRow("Country") = txtCountry.Text
                    TmpRow("Pincode") = txtPincode.Text
                    TmpRow("Phone") = txtPhone.Text
                    TmpRow("Mobile") = txtMobile.Text
                    TmpRow("Fax") = txtFax.Text
                    TmpRow("Email") = txtEmail.Text
                    TmpRow.EndEdit()
                End If
            End If
            DAUpdate()
            ROTrue()
            Operation = ""
            btnNew.Enabled = True
            btnClose.Enabled = True
            btnCancel.Enabled = False
            btnSave.Enabled = False
            dgClient.Enabled = True
        End If
    End Sub
    Sub ROTrue()
        txtName.ReadOnly = True
        txtContact.ReadOnly = True
        txtAddress.ReadOnly = True
        txtCity.ReadOnly = True
        txtCountry.ReadOnly = True
        txtPincode.ReadOnly = True
        txtPhone.ReadOnly = True
        txtFax.ReadOnly = True
        txtMobile.ReadOnly = True
        txtEmail.ReadOnly = True
    End Sub
    Sub ROFalse()
        txtName.ReadOnly = False
        txtContact.ReadOnly = False
        txtAddress.ReadOnly = False
        txtCity.ReadOnly = False
        txtCountry.ReadOnly = False
        txtPincode.ReadOnly = False
        txtPhone.ReadOnly = False
        txtFax.ReadOnly = False
        txtMobile.ReadOnly = False
        txtEmail.ReadOnly = False
    End Sub
    Sub DAUpdate()
        DA.Update(DsClient1, "Client")
        DA.Fill(DsClient1, "Client")
    End Sub
    Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        TmpTable = DsClient1.Tables("Client")
        TmpRow = TmpTable.Rows.Find(cid)
        If (MessageBox.Show("Do You Want to Delete the Current Record ?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = DialogResult.Yes) Then
            TmpRow.Delete()
            DAUpdate()
        End If
    End Sub
    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        btnNew.Enabled = True
        btnClose.Enabled = True
        btnCancel.Enabled = False
        btnSave.Enabled = False
        dgClient.Enabled = True
        ROTrue()
        Clear()
        DAUpdate()
    End Sub
    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub
    Sub Clear()
        txtName.Text = ""
        txtContact.Text = ""
        txtAddress.Text = ""
        txtCity.Text = ""
        txtCountry.Text = ""
        txtPincode.Text = ""
        txtPhone.Text = ""
        txtFax.Text = ""
        txtMobile.Text = ""
        txtEmail.Text = ""
    End Sub
    Sub Store()
        oDetails.AgName = txtName.Text
        oDetails.AgContact = txtContact.Text
        oDetails.AgAddress = txtAddress.Text
        oDetails.AgCity = txtCity.Text
        oDetails.AgCountry = txtCountry.Text
        oDetails.AgPincode = txtPincode.Text
        oDetails.AgPhone = txtPhone.Text
        oDetails.AgMobile = txtMobile.Text
        oDetails.AgFax = txtFax.Text
        oDetails.AgEmail = txtEmail.Text
    End Sub
End Class

⌨️ 快捷键说明

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