private DataTable GetDataTableFromDataGridview(DataGridView _grid) { { var _oDataTable = new DataTable(); object[] cellValues = new object[_grid.Columns.Count]; //clearTable(); _oDataTable.Columns.Add("Name", typeof(string)); _oDataTable.Columns.Add("Value", typeof(string)); _oDataTable.Columns.Add("Font", typeof(string)); _oDataTable.Columns.Add("DateStamp", typeof(string)); _oDataTable.Columns.Add("Comment", typeof(string)); foreach (DataGridViewRow row in _grid.Rows) { for (int i = 0; i < row.Cells.Count; i++) { cellValues[i] = row.Cells[i].Value; } _oDataTable.Rows.Add(cellValues.ToArray()); } return _oDataTable; } }
private DateTime _dateTime; string _DateTimeFormat = "yyyy/dd/MM HH:mm:ss"; public void UpdateTheCurrentTime() { _dateTime = DateTime.Now; _dateTime.ToString(_DateTimeFormat, CultureInfo.InvariantCulture); }
pre
DataGridView
DateTimeStamp
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)