DGV addingnew but no data

Arkette

Well-known member
Joined
Apr 20, 2006
Messages
50
Location
Europe
Programming Experience
10+
I have a strange little problem with a bound datgridview. The DGV is on an unbound form but is itself bound to a bindingsource which is in turn bound to a bindinglist(of T) which encapsulates a list of business objects (with me so far.) Ok so when the user clicks an empty row in the DGV the addingnew event is fired immediately - kind of odd behaviour that I thought. The user then types some text into the new rows first field. When I check the contents of the bindinglist a new object has indeed been added but does not contain the text that was typed; in short it is completely blank. If you then reload the form move to the blank row added previously and enter the text again, then the empty object in the binding list is correctly updated.
I hope you have all been able to follow this explanation and I hope even more that someone can explain what is going on.
 
Actually I have solved this problem. Strangely it was necessary to call endedit on the DGV and the binding source in sequence. Calling endedit on the bindingsource only for some reason doesn't commit any pending edit on the DGV.
 
Back
Top