I have a DataGridView and I dynamically populate it from my database using the following code
DataGridViewTextBoxColumn colID = new DataGridViewTextBoxColumn(); colID.HeaderText = "id"; colID.DataPropertyName = "id"; colID.ReadOnly = true; colID.Visible = false; dtgvLoadEx.Columns.Add(colID); DataGridViewTextBoxColumn colLoadExpiryDate = new DataGridViewTextBoxColumn(); //CalendarColumn colLoadExpiryDate = new CalendarColumn(); colLoadExpiryDate.HeaderText = "LoadExpiryDate(mm/dd/yy)"; colLoadExpiryDate.Width = 158; colLoadExpiryDate.DataPropertyName = "LoadExpiryDate"; colLoadExpiryDate.ReadOnly = false; colLoadExpiryDate.MaxInputLength = 10; dtgvLoadEx.Columns.Add(colLoadExpiryDate); dtgvLoadEx.DataSource = data(); //Return data table from my Database
As you can see, I have a Date column. When I try to edit a cell of this column and enter an invalid format, a DataError event will occur.
Now I just want to get the error text from
private void dtgvLoadEx_DataError(object sender, DataGridViewDataErrorEventArgs e) { }
or any other process to get the error text.
source share