private void purchaseinvoice_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1 && e.ColumnIndex != -1)
                {
                    add_button.Enabled = false;

                    if (edit == true) //updating member
                    {
                        save_button.Enabled = true;
                    }
                    else if (edit == false) //adding member
                    {
                        save_button.Enabled = false;
                    }

                    if (e.ColumnIndex == 8)
                    {
                        DataGridViewRow row = purchase_dataGridView.Rows[e.RowIndex];

                        gross_total -= Convert.ToSingle(row.Cells["totalGV"].Value.ToString());

                        gross_total_price_label.Text = gross_total.ToString();

                        purchase_dataGridView.Rows.Remove(row);

                        save_button.Enabled = true;

                        view_button.Enabled = false;
                    }
                    else
                    {
                        DataGridViewRow row = purchase_dataGridView.Rows[e.RowIndex];

                        supplier_comboBox.Text = row.Cells["suppliernameGV"].Value.ToString();

                        product_name_textBox_purchase_invoice.Text = row.Cells["productnameGV"].Value.ToString();

                        product_barcode_textBox_purchase_invoice.Text = row.Cells["productbarcodeGV"].Value.ToString();

                        per_unit_price_textBox.Text = row.Cells["perunitpriceGV"].Value.ToString();

                        product_quantity_textBox.Text = row.Cells["productquantityGV"].Value.ToString();

                        MainClass.disbale(left_panel_sample2);

                        delete_button.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MainClass.ShowMsg(ex.Message, "Error");

                MainClass.disbale_reset(left_panel_sample2); enable_crude_buttons();
            }
        }
        private void users_dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    add_button.Enabled = false;

                    if (edit == 1) //updating member
                    {
                        save_button.Enabled = true;
                    }
                    else if (edit == 0) //adding member
                    {
                        save_button.Enabled = false;
                    }

                    DataGridViewRow row = users_dataGridView.Rows[e.RowIndex];

                    USERID = Convert.ToInt32(row.Cells["useridGV"].Value.ToString());

                    name_textBox.Text = row.Cells["nameGV"].Value.ToString();

                    email_textBox.Text = row.Cells["emailGV"].Value.ToString();

                    password_textBox.Text = row.Cells["passwordGV"].Value.ToString();

                    phone_number_textBox.Text = row.Cells["phonenumberGV"].Value.ToString();

                    status_comboBox.SelectedItem = row.Cells["statusGV"].Value.ToString();

                    role_textBox.Text = row.Cells["roleGV"].Value.ToString();

                    MainClass.disbale(left_panel_sample2);

                    delete_button.Enabled = true;

                    edit_button.Enabled = true;

                    save_button.Enabled = false;

                    cancel_button.Enabled = true;

                    view_button.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MainClass.ShowMsg(ex.Message, "Error");
            }
        }