private void FormMain_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.F)
            {
                FeeSubmission feeSubmission = new FeeSubmission();
                feeSubmission.ShowDialog();
            }

            if (e.Control && e.KeyCode == Keys.S)
            {
                SearchStudent search = new SearchStudent();
                search.ShowDialog();
            }

            if (e.Control && e.KeyCode == Keys.A)
            {
                AddStudent search = new AddStudent();
                search.ShowDialog();
            }

            if (e.Control && e.KeyCode == Keys.V)
            {
                FeeVoucher vouc = new FeeVoucher();
                vouc.ShowDialog();
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string     value = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].FormattedValue.ToString();
            AddStudent s     = new AddStudent();

            if (value == "Edit")
            {
                string id1 = dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString();
                id = Convert.ToInt32(id1);
                txt_FirstName.Text      = dataGridView1.Rows[e.RowIndex].Cells[1].FormattedValue.ToString();
                txt_LastName.Text       = dataGridView1.Rows[e.RowIndex].Cells[2].FormattedValue.ToString();
                txt_Contact.Text        = dataGridView1.Rows[e.RowIndex].Cells[3].FormattedValue.ToString();
                txt_Email.Text          = dataGridView1.Rows[e.RowIndex].Cells[4].FormattedValue.ToString();
                txt_RegistrationNo.Text = dataGridView1.Rows[e.RowIndex].Cells[5].FormattedValue.ToString();
                cmb_Status.Text         = s.getCategoryNameById(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[6].FormattedValue.ToString()));
                //txt_Status.Text = dataGridView1.Rows[e.RowIndex].Cells[6].FormattedValue.ToString();
                btn_Add.Enabled    = false;
                btn_Update.Enabled = true;
            }
            else if (value == "Delete")
            {
                string id1 = dataGridView1.Rows[e.RowIndex].Cells[0].FormattedValue.ToString();
                id = Convert.ToInt32(id1);


                DataTable dt = new DataTable();
                dt = s.Delete(id);
                dataGridView1.DataSource = dt;
            }
        }
        private void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                AddStudent s = new AddStudent();

                s.firstName      = txt_FirstName.Text;
                s.lastName       = txt_LastName.Text;
                s.contact        = txt_Contact.Text;
                s.email          = txt_Email.Text;
                s.registrationNo = txt_RegistrationNo.Text;
                //string s1 = txt_Status.Text;

                lbl_ErrorFirstName.Text      = s.ErrorFirstName(s.firstName);
                lbl_ErrorFirstName.ForeColor = System.Drawing.Color.Red;
                lbl_ErrorFirstName.Refresh();

                lbl_ErrorLastName.Text      = s.ErrorLastName(s.lastName);
                lbl_ErrorLastName.ForeColor = System.Drawing.Color.Red;
                lbl_ErrorLastName.Refresh();

                lbl_ErrorContact.Text      = s.ErrorContact(s.contact);
                lbl_ErrorContact.ForeColor = System.Drawing.Color.Red;
                lbl_ErrorContact.Refresh();

                lbl_ErrorEmail.Text      = s.ErrorEmail(s.email);
                lbl_ErrorEmail.ForeColor = System.Drawing.Color.Red;
                lbl_ErrorEmail.Refresh();

                lbl_ErrorRegistrationNo.Text      = s.ErrorRegistrationNo(s.registrationNo);
                lbl_ErrorRegistrationNo.ForeColor = System.Drawing.Color.Red;
                lbl_ErrorRegistrationNo.Refresh();

                if (lbl_ErrorFirstName.Text == "" && lbl_ErrorLastName.Text == "" && lbl_ErrorContact.Text == "" && lbl_ErrorEmail.Text == "" && lbl_ErrorRegistrationNo.Text == "")
                {
                    //s.status = Convert.ToInt32(s1);
                    s.status = s.getLookupIdByStatus(cmb_Status.Text);
                    DataTable dt = new DataTable();
                    dt = s.addStudent();

                    dataGridView1.DataSource = dt;

                    txt_FirstName.Clear();
                    txt_LastName.Clear();
                    txt_Contact.Clear();
                    txt_Email.Clear();
                    txt_RegistrationNo.Clear();
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
        private void AddStudents_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'projectBDataSet.Student' table. You can move, or remove it, as needed.
            this.studentTableAdapter.Fill(this.projectBDataSet.Student);

            AddStudent s = new AddStudent();

            s.AddToComboBox(cmb_Status);
            cmb_Status.Text = cmb_Status.Items[0].ToString();

            btn_AddStudents.Enabled      = false;
            btn_Update.Enabled           = false;
            btn_AddStudents.BackColor    = Color.Gray;
            lbl_ErrorFirstName.Text      = "";
            lbl_ErrorLastName.Text       = "";
            lbl_ErrorRegistrationNo.Text = "";
            lbl_ErrorEmail.Text          = "";
            lbl_ErrorContact.Text        = "";
        }
        private void paneladdstd_Click(object sender, EventArgs e)
        {
            AddStudent ad = new AddStudent();

            ad.Show();
        }