【发布时间】:2018-01-19 08:47:10
【问题描述】:
正在做的是一个披萨菜单,我有 3 个 dataGridView,第一个显示菜单,第二个显示所选披萨的成分,第三个显示成分列表(用户可以添加删除成分)。问题是我需要通过自动更新从第二个 DGV 计算成分的价格,然后在第一个 DGV 中显示最终价格
pizzaGrid.DataSource = SelectedList;
DataGridViewCell pizzacell = MenuGrid.CurrentCell;
DataGridViewCell ingrecell = IngredientCell.Currentcell;
int total = 0;
for(int i = 0; i < ingredientList.Count; i++)
{
Ingredient ingre = ingredientList[i];
if(ingredientList.Contain(i))
{
total++;
SelectedList.Add(i);
}
}
【问题讨论】:
-
到目前为止你写过代码吗?如果是这样,请将其添加到您的问题中,如果不是:StackOverflow 是针对特定实现问题的,而不是让我们为您编写代码。参考:stackoverflow.com/help/how-to-ask
-
@FreekW,我试过 for 循环,但没用
-
然后添加那个代码,也添加添加项目的代码(这里是披萨和配料),因为你的描述比较模糊。
-
我附上了我试过@FreekW的代码截图
标签: c# datagridview window