Its in C# hope this helps
private void buildDataTable() {
DataTable dt = new DataTable("test");
dt.Columns.Add("col1", typeof(int));
dt.Columns.Add("col2", typeof(int));
dt.Columns.Add("col3", typeof(int));
dt.Rows.Add(1, 2);
dt.Rows.Add(2, 3);
dt.Rows.Add(3, 4);
dt.Rows.Add(4, 5);
foreach (DataRow dr in dt.Rows) {
dr[2] = (int)dr[0] + (((int)dr[1] * 100) / 100);
}
dgv1.DataSource = dt;
}
private void addColunmAndValue() {
dgv1.Columns.Add("Col4", "Col4");
foreach (DataGridViewRow dr in dgv1.Rows) {
DataGridViewCellCollection dc = dr.Cells;
if (!dr.IsNewRow) {
dc[3].Value = (int)dc[2].Value + ((int)dc[1].Value * 100);
}
}
}