Hi all,
I have a form with a datagridview (dgv) that's bound to its bindingsource, dataset, and table adapter. I'm trying to figure how to programmatically update rows/cells in the dgv with values from either a text box, or a row from another dgv.
First case, for example, in a textbox on the form, you enter "Dogs" and you want to update a cell in the currently selected row in the dgv, this works to a point:
me.bindingsource.current("PetType") = me.textbox1.text
me.bindingsource.endedit()
me.datagridview.update()
me.tableadapter.update(me.dataset.table)
This updates the dgv, but the last line for the tableadapter errors and the update never gets flushed to the table.
Second case, for example, you want to take the selected row in one dgv and update the selected row in a second dgv with the values in the first dgv. Isn't there a way to place the values of the first dgv's selected row into an array, then update the specifically selected row in the second dgv... and then flush it to the table?
Thanks for your help with these elementary data updating questions,
Tom.
I have a form with a datagridview (dgv) that's bound to its bindingsource, dataset, and table adapter. I'm trying to figure how to programmatically update rows/cells in the dgv with values from either a text box, or a row from another dgv.
First case, for example, in a textbox on the form, you enter "Dogs" and you want to update a cell in the currently selected row in the dgv, this works to a point:
me.bindingsource.current("PetType") = me.textbox1.text
me.bindingsource.endedit()
me.datagridview.update()
me.tableadapter.update(me.dataset.table)
This updates the dgv, but the last line for the tableadapter errors and the update never gets flushed to the table.
Second case, for example, you want to take the selected row in one dgv and update the selected row in a second dgv with the values in the first dgv. Isn't there a way to place the values of the first dgv's selected row into an array, then update the specifically selected row in the second dgv... and then flush it to the table?
Thanks for your help with these elementary data updating questions,
Tom.