HLP: Updating a Column in a DataGrid Globally

  • Thread starter Thread starter Mr. B
  • Start date Start date
M

Mr. B

I've asked this before (several weeks ago)... but no replies (other than one
not giving much hope).

So I'd like to try again as I 'think' this can be done. And if so, some
pointing in the right direction would be appreciated. So here goes...

My application opens an MS Access db... I get the info, etc. At one point I
display 7 lines and 6 columns of my db. The displayed info is related and
only the last column has different info (ie hours). It looks like this:

Proj # Cost Code Description Week Date Week Ending Hours
10-02-100 65 Meetings 09/03/2004 12/03/2003 1.0
10-02-100 65 Meetings 09/03/2004 12/03/2003 2.0
10-02-100 65 Meetings 09/03/2004 12/03/2003 1.5
10-02-100 65 Meetings 09/03/2004 12/03/2003 0.5
10-02-100 65 Meetings 09/03/2004 12/03/2003 3.5
10-02-100 65 Meetings 09/03/2004 12/03/2003 1.0
10-02-100 65 Meetings 09/03/2004 12/03/2003 4.0

This info is displayed in a DataGrid and I bind the db info to the DataGrid.

Currently I lock all columns 'except' the Hours as I let the Users
modify/correct their hours (they then can save the updates back to the db via
an Update db button).

What I'd like to do is to introduce a TextBox and display the 'current'
DESCRIPTION. The user could then modify the Description in the Textbox and
click an Accept button... then ALL of the above Descriptions would update to
the modified version. And the db gets updated when they click the Update db
button.

What I'm having difficulties is figuring out HOW to change all of the
Description cells in the DataGrid with my modified Text. I wish to retain the
'lock' on the first 5 columns to prevent them from screwing up the data (as
all the first 5 columns info 'must' be the same). This is why I want to have
the User modify the Description in ONE place and do a global update.

Any help/tips/code would be greatly appreciated.

Regards,

Bruce
 
Hi Bruce,

I've done similar things, and this is the way I've chosen: I loop through
the datatable and make the changes row after row; I then update the backend.
After I'm done, I clear the datatable from the grid, and then rebuild the
grid with the updated datatable.

Now, I'm using C1 true db grid, but that really shouldn't make a difference,
as the changes relate only to the datatable, not the grid itself.

HTH,

Bernie Yaeger
 
Back
Top