Click here to Skip to main content
14,668,708 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a datagridview that has a percentage symbol in the cell. I need to convert to a percentage before calculating. The data looks like 17% and I need it to look like 0.17.

What I have tried:

string cellValue;
              cellValue = dataGridView1.Rows[i].Cells[17].Value.ToString(); // % Cycle Remaining
              cellValue = cellValue.Replace("%", "");
              dataGridView1.Rows[i].Cells[17].Value = cellValue ;  // % Cycle Remaining


              int a = Int32.Parse(tb_OrderCycle.Text);
              int b = Convert.ToInt32(dataGridView1.Rows[i].Cells[17].Value);  // % Cycle Remaining
              int C = a * b ;
              dataGridView1.Rows[i].Cells[32].Value = C; //Min. into Cycle
Posted
Updated 5-Jul-20 6:15am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Converting a percentage number to its actual value is just a matter of dividing by 100.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100