private void btnrgd_update_Click(object sender, EventArgs e)
        {
            this.Hide();
            Student_registration s = new Student_registration(first_name, last_name, father_name, father_id, email, mobile, class_name, dob, address, gender, city, province, country, id);

            s.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int flag = 0;

            if (IsFormValid())
            {
                sqlconnection  con = new sqlconnection();
                SqlDataAdapter sda = new SqlDataAdapter(" Select Username,Password,Role from LoginTable where Username='******' and Password='******' ", con.openconn());
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Username"].ToString() == usernametext.Text && dt.Rows[i]["Password"].ToString() == passwordtext.Text)
                    {
                        flag = 1;
                        if (dt.Rows[i]["Role"].ToString() == "Admin")
                        {
                            this.Hide();
                            MainForm obj = new MainForm();
                            obj.Show();
                        }
                        else if (dt.Rows[i]["Role"].ToString() == "User")
                        {
                            this.Hide();
                            Student_registration obj1 = new Student_registration();
                            obj1.Show();
                        }
                    }
                }
                if (flag == 0)
                {
                    MessageBox.Show("Invalid Username/Pasword");
                }
            }
        }
        private void btn_new_Click(object sender, EventArgs e)
        {
            this.Hide();
            Student_registration std = new Student_registration();

            std.Show();
        }