如何在运行时获取datagridview的列值 [英] how to get columns values of datagridview at run time
本文介绍了如何在运行时获取datagridview的列值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想检索数据网格的列值并且必须对其进行计算
我该怎么做?
plz help
和thanx提前..
i want to retrieve the column values of the data grid and have to make calculation on it
how can i do it?
plz help
and thanx in advance..
推荐答案
你不是真的。 DataGridView绑定到数据源;从该源读取。
You don''t really. A DataGridView binds to a Data Source; read from that source.
可能位于代码cn help u。
for(int i = 0; i< datagridview1 .rows.count; i ++)>
{
double price = 5.0;
double totalamt = Convert.ToDouble(DataGridView1.Rows [ i] .Cells [qty]。Value.ToString())*(price);
DataGridView1.Rows [i] .Cells [qty]。Value = totalamt;
}
i希望这段代码能帮你实现你的任务
享受:)
may be below code cn help u.
for (int i=0;i<datagridview1.rows.count;i++)>
{
double price =5.0;
double totalamt= Convert.ToDouble(DataGridView1.Rows[i].Cells["qty"].Value.ToString()) * (price);
DataGridView1.Rows[i].Cells["qty"].Value = totalamt;
}
i hope this code will help u achieve ur task
Enjoy :)
如何在datagrid中对值进行计算?
或其他任何方式
how can i perform calculations on values in datagrid any idea?
or any other way of doing this
这篇关于如何在运行时获取datagridview的列值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文