Hi,

I'm looking for advice or samples regarding the implementation of what is
essentially a bound grid, most columns are bound, however there are a couple
of unbound columns which are basically calculated totals (read-only) of data
in the bound columns (which are read/write).

I've implemented the CellValueNeeded event for the unbound columns. This
works when each row is first loaded. However, I then need to be responsive
to changes that that the user may make to the values of the bound columns.
when this happens, I need to recalculate the values of the bound columns. I
know whenever the user makes a change to a cell; CellValueChanged. At that
point, how to I 'invalidate' the current row so that it will refetch all of
the calculated columns (thus causing the recalculated values to appear). So
here's what I really need to understand how to do:

1. Force an Unbound cell to refresh its value.
2. Force all Unbound cells in a given Row to refresh their values.
3. Force all Rows in a Grid to refresh all of their respective unbound
columns.

(and if someone can show me a link, I'd really appreciate it. I'm usually
pretty good with Google but for some reason in this case, I'm turning up
documentation on Bound and Unbound modes, but really very little on the
mixed mode of binding which I'm trying to implement.)

Thanks for your advice!!!

Joseph Geretz

Re: Seeking advice for DataGridView with several Unbound Columns by Nicholas

Nicholas
Mon Jul 30 16:45:25 CDT 2007

Joseph,

It looks like you can use the UpdateCellValue method to force a firing
of the CellValueNeeded event for the unbound cells that you wish to update.
I don't see an overload which will take whole rows or columns, but you
should be able to figure that out easily.

Here is a link to the UpdateCellValue documentation:

http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridview.updatecellvalue.aspx

--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com

"Joseph Geretz" <jgeretz@nospam.com> wrote in message
news:ukFthEv0HHA.4928@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I'm looking for advice or samples regarding the implementation of what is
> essentially a bound grid, most columns are bound, however there are a
> couple of unbound columns which are basically calculated totals
> (read-only) of data in the bound columns (which are read/write).
>
> I've implemented the CellValueNeeded event for the unbound columns. This
> works when each row is first loaded. However, I then need to be responsive
> to changes that that the user may make to the values of the bound columns.
> when this happens, I need to recalculate the values of the bound columns.
> I know whenever the user makes a change to a cell; CellValueChanged. At
> that point, how to I 'invalidate' the current row so that it will refetch
> all of the calculated columns (thus causing the recalculated values to
> appear). So here's what I really need to understand how to do:
>
> 1. Force an Unbound cell to refresh its value.
> 2. Force all Unbound cells in a given Row to refresh their values.
> 3. Force all Rows in a Grid to refresh all of their respective unbound
> columns.
>
> (and if someone can show me a link, I'd really appreciate it. I'm usually
> pretty good with Google but for some reason in this case, I'm turning up
> documentation on Bound and Unbound modes, but really very little on the
> mixed mode of binding which I'm trying to implement.)
>
> Thanks for your advice!!!
>
> Joseph Geretz
>