Click here to Skip to main content
14,693,130 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi folks

I use DataGridView in my project. Everything worked fine until I added some code in the RowValidating event. During the form_load event exception is thrown on the statement that set the datasource of the DataGridView.

The project uses bindingsource for the datasource of the DataGridView. My validating code is shown below:

Dim currentRow As DataGridViewRow = Me.dgExpenditure.Rows(e.RowIndex)
Dim incexpCell As DataGridViewCell = currentRow.Cells(0)

If Not Me.closingBoolean Then
If incexpCell.FormattedValue.ToString = String.Empty Then
Me.showExpIncAccCellError(incexpCell)
e.Cancel = True
Else
Me.clearCellError(incexpCell)
e.Cancel = False
End If
Else

Me.dgExpenditure.ShowCellErrors = False
Me.dgExpenditure.ShowRowErrors = False

End If


Thanks in advance.
Posted
Updated 6-May-12 18:46pm
Comments
Sandeep Mewara 7-May-12 2:31am
   
What exception?
noblepaulaziz 7-May-12 8:55am
   
'Operation did not succeed because the program cannot commit or quit a cell value change'

1 solution

Look at the following discussions:
Discussion 1[^]
Discussion 2[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900