c# Get the cell text value if DataError is triggered
c#, datagridview
Solution
Ok guys I Already Solved the Problem. Here I'm gonna share it
private void dtgvLoadEx_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
string s = dtgvLoadEx.EditingControl.Text;
}
Problem
I have a `DataGridView` and I populate it dynamically from my database via 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 attempt to edit a cell of that column and type an invalid format, the `DataError` event will triggered. Now I just want to get the error text from ``` private void dtgvLoadEx_DataError(object sender, DataGridViewDataErrorEventArgs e) { } ``` or any other process in order to get the error text.