dv2020
Active member
- Joined
- Dec 18, 2020
- Messages
- 30
- Programming Experience
- 1-3
Hi All,
Trying to adjust my code to
a) When a user selects a value from the combo box in the data grid, it copies a value from a different column into another
b) When the data grid refreshes, looks up each value and copies the look up values from a different column into another (for each row)
c) when the copied value comes over into the new column, it keeps its format which is a %.
The below code partially works when I call it from an event (e.g CellClick), although removes the % formating when the new value is copied in.
Furth more, when I call it after the data grid has loaded it does not work at all.
any ideas ?
Thanks
Dv
Trying to adjust my code to
a) When a user selects a value from the combo box in the data grid, it copies a value from a different column into another
b) When the data grid refreshes, looks up each value and copies the look up values from a different column into another (for each row)
c) when the copied value comes over into the new column, it keeps its format which is a %.
The below code partially works when I call it from an event (e.g CellClick), although removes the % formating when the new value is copied in.
Furth more, when I call it after the data grid has loaded it does not work at all.
Current Code:
for (int i = 0; i < datagridProSpeedMap.Rows.Count; i++)
{
DataGridViewRow row = datagridProSpeedMap.Rows[i];
if (row.Cells["MAP_SPEED"].Value.ToString() == "LEAD") // If the user selects LEAD from the combo box in the DG
{
row.Cells["RSS_SPEED"].Value = row.Cells["JRL"].Value.ToString(); // get the value from column JRL and place it into column RSS_SPEED.
row.Cells["HSS_SPEED"].Value = row.Cells["HRL"].Value.ToString(); // get the value from column HRL and place it into column HSS_SPEED.
}
if (row.Cells["MAP_SPEED"].Value.ToString() == "ON-PACE")
{
row.Cells["RSS_SPEED"].Value = row.Cells["JRONP"].Value.ToString(); // get the value from column JRONP and place it into column RSS_SPEED.
row.Cells["HSS_SPEED"].Value = row.Cells["HRONP"].Value.ToString(); // get the value from column HRONP and place it into column RSS_SPEED.
}
}
any ideas ?
Thanks
Dv