private void Form_Closing(object sender, FormClosingEventArgs e) { DataTable outputTable = myDataGridView.DataSource as DataTable; OutputTable.Set(this.contextGlobal, outputTable); //Get info of selected Cell if (this.myDataGridView.SelectedCells.Count > 0) { Dictionary <string, string> props = new Dictionary <string, string>(); int rowIndex = myDataGridView.CurrentCell.RowIndex; int columnIndex = myDataGridView.CurrentCell.ColumnIndex; String columnName = myDataGridView.Columns[columnIndex].Name; String value = myDataGridView.CurrentCell.Value.ToString(); props.Add("rowIndex", rowIndex.ToString()); props.Add("columnIndex", columnIndex.ToString()); props.Add("columnName", columnName); props.Add("value", value); SelectedCell.Set(this.contextGlobal, props); } e.Cancel = false; }