Exemple #1
0
        private void activityToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmActivity frm = new frmActivity();

            frm.lblUser.Text     = User.Text;
            frm.lblUserType.Text = UserType.Text;
            frm.Show();
        }
        private void dataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (SET.Text == "CS")
                {
                    DataGridViewRow dr = dataGridView2.SelectedRows[0];
                    this.Hide();
                    frmActivity frm = new frmActivity();
                    // or simply use column name instead of index
                    //dr.Cells["id"].Value.ToString();
                    frm.Show();

                    frm.txtID.Text   = dr.Cells[0].Value.ToString();
                    frm.txtdate.Text = dr.Cells[1].Value.ToString();

                    frm.txtcontactID.Text = dr.Cells[2].Value.ToString();

                    frm.txtContact.Text      = dr.Cells[3].Value.ToString();
                    frm.txtAssignedto.Text   = dr.Cells[5].Value.ToString();
                    frm.txtActivityType.Text = dr.Cells[6].Value.ToString();
                    frm.txtstatus.Text       = dr.Cells[7].Value.ToString();
                    frm.txtsubject.Text      = dr.Cells[8].Value.ToString();
                    frm.txtNotes.Text        = dr.Cells[9].Value.ToString();
                    frm.txtstaffID.Text      = dr.Cells[10].Value.ToString();

                    frm.lblUser.Text      = lblUser.Text;
                    frm.lblUserType.Text  = lblUserType.Text;
                    frm.btnUpdate.Enabled = true;
                    frm.btnDelete.Enabled = true;
                    frm.btnNew.Enabled    = true;
                    frm.btnSave.Enabled   = false;
                    frm.txtdate.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }