WFA_psychometric_chart.Form1_main.RefreshingEverythingChartAndContent C# (CSharp) Method

RefreshingEverythingChartAndContent() public method

public RefreshingEverythingChartAndContent ( object sender ) : void
sender object
return void
        public void RefreshingEverythingChartAndContent(object sender)
        {


            dataGridView1.Rows.Clear();//--This one is for clearing the data
            dataGridView1.Refresh();//--Release the previously selectecd items
            dataGridView1.Rows.Add();
            //   MessageBox.Show("Reached before refreshGraph() and after datagv ref");
            DataGridView_Show_Data();

            //If there is no rows in datagridview...
            //if(dataGridView1.Rows.Count < 1) { 



            RefreshGraph();

            //after deletion lets select the its corresponding upper chart
            //Select the chart with was selected
            if (chartDetailList.Count > 0)
            {
                //We need to select the particular index 
                //--I hope this will do the replotting thing as well
                if (dataGridView1.Rows[0].Cells[1].Value != null)
                {
                    dataGridView1.Rows[0].Cells[1].Selected = true;//The row is selected 
                }

            }


            if (chartDetailList.Count > 0)
            {
                //if (dataGridView1.CurrentCell.RowIndex >= 1)
                //{
                //    //set parameters of your event args
                //    var eventArgs = new DataGridViewCellEventArgs(1, dataGridView1.CurrentCell.RowIndex-1);
                //    // or setting the selected cells manually before executing the function
                //    dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex - 1].Cells[1].Selected = true;
                //    dataGridView1_CellClick(sender, eventArgs);
                //} else
                //{ 
                //set parameters of your event args
                var eventArgs = new DataGridViewCellEventArgs(1, 0);
                // or setting the selected cells manually before executing the function
                dataGridView1.Rows[0].Cells[1].Selected = true;
                dataGridView1_CellClick(sender, eventArgs);
                // }
            }

        }

Usage Example

コード例 #1
0
        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);
            }
        }
Form1_main