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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vb.net 2008: Datagridview resetting unbound column values on remove

Status
Not open for further replies.

rw409168

Programmer
Jul 16, 2009
95
GB
Greetings,

I've programmatically created a datagridview which contains DataGridViewCheckBoxColumns.

I later assign the datagridview a datasource from a dataset -> datatable and for bound columns set the datapropery to the appropriate datatable columns.

When I remove datarows from the datagridview programmatically via the code below, the unbound columns always have their values reset to "false" (DataGridViewCheckBoxColumns).

Code:
 bookingsdata.Tables("bookings").Rows.Remove(DirectCast(DataGridView1.Rows(i).DataBoundItem, DataRowView).Row)
                        bookingsdata.Tables("bookings").AcceptChanges()

Firstly is this usual behaviour?
I'm sure code is not changing the column values.

Can anyone help me in resolving this?

I'm a newbie to sqlserver and don't like the idea of trying to store a boolean type value into the datatable if need be (ermm because I dont know how).

Seems silly to store it too as all it is used for to highlight selection.

Upon clicking a button a loop checks for selected rows then removes them.

Does anyone have any ideas how to progress, i.e. if a row gets removed from the datagridview then the unbound columns are not affected?

Thanks
Rob
 
Would perhaps using the datagridview virtualmode help with this?
 
Issue now resolved by adding a boolean datatype to the datatable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top