Inicio > .Net > [How To] Obtener el total de una Columna Vertical en un DataGridView en C#

[How To] Obtener el total de una Columna Vertical en un DataGridView en C#

8 noviembre 2011

Consulta de Foro: Como puedo obtener el total de las celdas con decimales de una columna en un datagridview.

Solución Corta:

DataTable dt = ((DataTable)dataGridView1.DataSource);
object total = dt.Compute(“SUM(UnitPrice)”, null);
this.TxtSumarTotal.Text = total.ToString();

UnitPrice: Campo a calcular.

Categorías:.Net
Seguir

Get every new post delivered to your Inbox.