private void btnSave_Click(object sender, EventArgs e)
        {
            if (SID.Text == "" || StdFName.Text == "" || SClass.Text == "" || SRoll.Text == "" || SSection.Text == "" || checkgender() == "" || SDOB.Text == "" || SStatus.Text == "" || SPAdd.Text == "" || SAddmissionDate.Text == "")
            {
                MessageBox.Show("Please Fill the Record Properly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (string.IsNullOrEmpty(SID.Text))
                {
                    MessageBox.Show("Please enter Student ID");
                    SID.Focus();
                    return;
                }
                else
                {
                    try
                    {
                        SPhoto.Image.Save(Application.StartupPath + "\\images\\" + SID.Text + ".jpg", ImageFormat.Jpeg);

                        SqlConnection conn = new SqlConnection(str);
                        SqlCommand    cmd  = new SqlCommand("insert into tbl_student ([SID],[Sname],[class],[roll],[section],[gender],[DOB],[status],[FName],[MName],[Lguardian],[phone],[Padd],[Tadd],[addate],[religion],[comment],[preSname],[preSphone],[preSadd],[passed],[photo]) values('" + SID.Text + "','" + StdFName.Text + "','" + SClass.Text + "','" + SRoll.Text + "','" + SSection.Text + "','" + checkgender() + "','" + SDOB.Text + "','" + SStatus.Text + "','" + SFName.Text + "','" + SMName.Text + "','" + SLocalGuardian.Text + "','" + textBox3.Text + "','" + SPAdd.Text + "','" + STAdd.Text + "','" + SAddmissionDate.Text + "','" + SReligion.Text + "','" + SComment.Text + "','" + PreSName.Text + "','" + PreSPhone.Text + "','" + PreSAdd.Text + "','" + PassedClass.Text + "','" + SID.Text + "')", conn);

                        try
                        {
                            conn.Open();
                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Student record inserted Succesfully", "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            reset();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Sorry! Exception occured" + ex);
                        }
                        finally
                        {
                            conn.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Please choose Student image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                        //throw;
                    }
                }
            }
        }