|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Addrow to DataGridViewHi, all
I want to add a row to a bound datagridview, suppose I need copy some columns of a row from datagridview2 to datagridview1, the user select a row in datagridview2, click a button, and then copy some columns of the selected row to a new added row in datagridview1. Bur when I try to add a row in datagridview1, the following exception throw: Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound. How can I add row to the DataGridView programmatically? Thanks! Hi ,
I think the idea out here is , since your control is databound , you need make relevant modification to the datasource like dataset , array of whatever you are using and rebind on button click and that should solve the issue, by refreshing the latest values to the control . hope that helps , Mrinal Taoge wrote: Show quote > Hi, all > > I want to add a row to a bound datagridview, suppose I need copy some > columns of a row from datagridview2 to datagridview1, the user select a row > in datagridview2, click a button, and then copy some columns of the selected > row to a new added row in datagridview1. Bur when I try to add a row in > datagridview1, the following exception throw: > > Rows cannot be programmatically added to the DataGridView's rows collection > when the control is data-bound. > > How can I add row to the DataGridView programmatically? > > Thanks! > > |
|||||||||||||||||||||||