Making changes to datagrid data in code

pachjo

Well-known member
Joined
Dec 12, 2006
Messages
370
Programming Experience
10+
Action:

a datagridview that has its datasource set to a datasetbindingsource and its datamember set to a table therein.

the user clicks on a single row and selects to mark the record.

A column in the underlying table is set to either true or false.

Problem:

How do I change the column value?

Do I have to change the cell value, then call update, clear and fill?

Do I have to use a find method to find the row in the dataset and if so how?

Code attempted so far with little success!

VB.NET:
' does this just modify the datagrid or the tableadapter or dataset or all?
Me.dgvPurchaseOrders.SelectedRows.Item(0).Cells(7).Value = blnDelivered

' I used something similar on a listview and this worked, but not here?
Me.PlannerSQLDataSet.purchase_orders.Rows.Find(Me.PlannerSQLDataSetBindingSource.Current).Item("delivered") = blnDelivered

' is this required?
Me.Purchase_ordersTableAdapter1.Update(Me.PlannerSQLDataSet.purchase_orders)

' is this required?
Me.PlannerSQLDataSet.purchase_orders.Clear()

' is this required?
Me.Purchase_ordersTableAdapter1.Fill(Me.PlannerSQLDataSet.purchase_orders)

Thnx for any help.....
 
Back
Top