c# - Adding rows programatically to a DataGridView that is data bound? -
i have problem , can't seem able solve it. thought here able out.
i have form has datagridview of customers. now, want add several customers datagridview without adding them database. because client must able create list of clients , when thats done add them @ once.
i have tried this:
string[] array = {"microsoft", "redmond", "something"} datagridview.rows.add (array);
now can't done because exception saying in lines of you cant add rows programatically datagridview data bound.
now have read can solved using table adapter insert rows instead of directly adding them via. dgv. not possible because use custom headers in dgv because existing data fetched via join's if add them via tableadapter exception doesn't match databases table schema.
now lost... know of (halfway) elegant solution problem?
thank you
bind dgv bindinglist<yourobject>
, yourobject
can simple class properties reflecting database schema. populate bindinglist
database, , dgv automatically add yourobject
instances list. when you're ready commit changes, manually bindinglist.
Comments
Post a Comment