private void btnDelRec_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult diaRes = MessageBox.Show("Do you want to delete the record?", "Delete record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (diaRes == DialogResult.Yes)
                {
                    Cursor = Cursors.WaitCursor;

                    if (DelelteRecordFromTable(currRecIndex - 1))
                    {
                        if (Delete_UpdateOperations.DeleteRecordFromSDFile(FileName, currRecIndex))
                        {
                            if (currRecIndex > 1)
                            {
                                currRecIndex--;
                                MaxRecCnt--;
                            }
                            else if (currRecIndex == 1 && MaxRecCnt > 1)
                            {
                                currRecIndex = 1;
                                MaxRecCnt--;
                            }
                            else if (currRecIndex == 1 && MaxRecCnt == 1)
                            {
                                currRecIndex = 0;
                                MaxRecCnt    = 0;

                                ClearUserInputs();
                            }

                            if (currRecIndex == numGoToRec.Value)
                            {
                                ReadMoleculeFromTable(currRecIndex - 1);
                                currRecIndex = Convert.ToInt32(numGoToRec.Value);
                            }
                            else if (currRecIndex > 0)
                            {
                                numGoToRec.Value   = currRecIndex;
                                numGoToRec.Maximum = numGoToRec.Maximum - 1;
                            }
                            else
                            {
                                numGoToRec.Minimum = 0;
                                numGoToRec.Maximum = 0;
                                numGoToRec.Value   = 0;
                            }

                            lblRecCnt.Text = MaxRecCnt.ToString();
                        }

                        Cursor = Cursors.Default;
                        MessageBox.Show("Deleted record successfully", "Delete record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                bool blVerified = false;

                if (chkVerifyV2000.Checked)
                {
                    if (!ChemistryOperations.CheckForV3000Format(chemRenditor.MolfileString))
                    {
                        blVerified = true;
                    }
                    else
                    {
                        MessageBox.Show("Molecule is in V3000 format", "V3000 format", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    blVerified = true;
                }
                if (blVerified)
                {
                    DialogResult diaRes = MessageBox.Show("Do you want to update?", "Update Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (diaRes == DialogResult.Yes)
                    {
                        Molecule objMol_out = null;
                        Cursor = Cursors.WaitCursor;

                        if (!ChemistryOperations.CheckForDuplicateStructure(FileName, chemRenditor.MolfileString, currRecIndex, out objMol_out))
                        {
                            string strMolFile    = chemRenditor.MolfileString;
                            string strMolWeight  = txtMolWeight.Text.Trim();
                            string strMolFormula = txtMolFormula.Text.Trim();
                            string strPageNo     = txtPageNo.Text.Trim();

                            string strPageLabel = txtPageLabel.Text.Trim();
                            if (strPageLabel == "")
                            {
                                strPageLabel = "00";
                            }

                            string strExampleNo = txtExampleNo.Text.Trim();
                            if (strExampleNo == "")
                            {
                                strExampleNo = "00";
                            }

                            string strIUPACName = txtIUPACName.Text.Trim();
                            string strEn_Name   = txten_Name.Text.Trim();

                            if (UpdateRecordInTable(currRecIndex - 1, strMolFile, strMolWeight, strMolFormula, strPageNo,
                                                    strPageLabel, strExampleNo, strIUPACName, strEn_Name))
                            {
                                if (Delete_UpdateOperations.UpdateRecordInSdFile(_filename, currRecIndex, strMolFile, strPageNo, strPageLabel,
                                                                                 strExampleNo, strIUPACName, strEn_Name))
                                {
                                    Cursor = Cursors.Default;
                                    MessageBox.Show("Record updated successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                                else
                                {
                                    Cursor = Cursors.Default;
                                    MessageBox.Show("Error in updating", "Update", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                }
                            }
                            else
                            {
                                Cursor = Cursors.Default;
                                MessageBox.Show("Error in updating", "Update", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        else
                        {
                            Cursor = Cursors.Default;
                            MessageBox.Show("Duplicate Record");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Default;
                ErrorHandling_NTS.WriteErrorLog(ex.ToString());
            }
        }