private void button1_Click(object sender, EventArgs e) { try { //--After applying ok we will restore all the data that has been //--triggered as false as to be true and load the value again //--Also close the window as soon as it is set /* * Steps : * 1.Check for all the check boxes and restore */ if (dataGridView1.Rows.Count <= 0) { //--If there is no data don't need to do futher processing return; } arrayList.Clear();//Empty the arraylist for (int i = 0; i < dataGridView1.RowCount; i++) { //--In rows we are looping . if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[3].Value)) //Will be true if checkedd { arrayList.Add(dataGridView1.Rows[i].Cells[1].Value.ToString()); //Insert the chart id values //storeRestoreList.Add(chartDetailListForDissabledValue[i].chartID); // MessageBox.Show("Value = " + dataGridView1.Rows[i].Cells[1].Value.ToString()); } } //MessageBox.Show("StoreRestoreList count =" + arrayList.Count); //--Now lets remove the checked values form the database sections //string buildingName = for (int i = 0; i < arrayList.Count; i++) { updateValueInDatabaseToTrue(buildingNameGlobal, arrayList[i].ToString()); } //--Now after updating call the datagridview_show_Data function in main chart and close the //window // Form1_main f1 = new Form1_main(); //Form1_main f1 = new Form1_main(); //f1.CheckSelectedBuilding(); //--We are claling the dataGridView_Show_Data is called // MessageBox.Show("DataGridView_show_Data Calls"); // f1.Form1_Load(sender, e); // f1.LoadFunctionForTrash(); //f1.chart1RefreshCustom(); //f1.dataGridView1.Rows.Clear(); //f1.DataGridView_Show_Data(); //f1.dataGridView1.Rows.Add(); //f1.Refresh(); //f1.RefreshGraph();//Refresh the graph //--Now close this form f1.RefreshingEverythingChartAndContent(sender);//Calling the function for refresh this.Close(); }catch (Exception ex) { MessageBox.Show(ex.Message); } }