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);
// }
}
}