I have a datagridview that is populated with data. The data are numbers. I want to get the value of certain cells, multiply that value by 60 and print the new value into the cells but all I can seem to do is get a string value. This is what I have so far:
private void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
double hrsToMins = (double.Parse(dgv.Rows[e.RowIndex].Cells["Hours"].Value.ToString())*60);
if (dgv.Columns[e.ColumnIndex].Name == "Hours")
{
if (dgv.Rows[e.RowIndex].Cells["Hours"].Value.ToString() != "0")
hoursToMins = Convert.ToDouble(e.Value);
}
}
This doesn't change anything. What am I doing wrong?
This is what works: