private void button1_Click(object sender, EventArgs e)
 {
     //Add
     NewDetails a = new NewDetails();
     a.type = "0";
     a.ref_no = tbRefNo.Text;
     a.ShowDialog();
     LoadDetails();
 }
        private void button3_Click(object sender, EventArgs e)
        {
            //Edit

            try
            {
                if (dataGridView1.CurrentCell.RowIndex < 0)
                {
                    MessageBox.Show("No records choose");
                    return;
                }
                NewDetails a = new NewDetails();
                a.type = "1";
                //Dat them
                a.dvkh = "1";
                a.ref_no = dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value.ToString();
                a.ID = dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value.ToString();
                a.ShowDialog();
                LoadDetails();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Check your data, please choose 1 record.");
            }
        }