Add value to data-bound datagridview during run-time

A

AY Xu

Dear expert,

I've a datagridview control bound to dataset/datatable via
bindingsource.The datatable has 4 columns, 1st column hidden in
datagridview, and value was added by program during run-time, the rest
3 columns enter by user. I've set datagridview allow add/edit/delete.
I know you can't programmly add value to datagridview which bound to a
data source. The value has to be add to data table instead.

The problem is: when I finish enter values for 3 visible columns and
leave cursor, now i got error: 1st column value null not allowed.
I've try put code in binding source event like: addingnew,
currentchanged and currentitemchanged etc. but does not work.
I think my code may have problem (sorry can't paste code here, i leave
it in office pc).
How can i reference to current editing row and which event will fire
before new row added to data table?

i use vsts 2008

Many thanks for your help!
A.Y. Xu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top