Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clear a cell value in datagrid

Status
Not open for further replies.

HRHK

Programmer
Jun 5, 2005
83
US
I tried to clear cell value in datagrid which is binded to a dataset but it doesn't go away.
How do I do this? Thanks.


For Each row In ds.Tables(0).Rows
If reqId = row("req_id") Then
row("unit_cost") = DBNull.Value
ds.AcceptChanges()
End If
Next
 
Code:
dim dt as datatable
dim row as datarow
dt = ds.tables(0)

for each row in dt.rows
if row.item(0) = "req_id" then
row.item(1) = dbnull.value
end if

DataGrid1.DataSource = ds
DataGrid1.SetDataBinding(ds, "dt")

I think this should work.. just replace the 0 and 1 with columns your checking(and changing). If your still having problems.. then let me know and I will actually test the code in a datagrid.. and see what I come up with

-mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top