vb.net - how do I parse a percentage value from a grid cell?
- by Bob Palin
I'm trying to parse a formatted percentage value back from a datagridviewcell that has been set with the "P" formatter:
double percent = 0.96
cell.value = percent.tostring("p")
gives me a displayed value of 96 % which is what I want.
Now what I'm looking for is something like what is provided for the other formatting strings - NumberStyles.HexNumber, Currency etc
so that I can do this
double percent= double.parse( cell.value, NumberStyles.Percent )
which would give me a percent value of .96
I have scoured the .net documentation but can't find any sort of AllowPercent style like the others - is there one?
Bob Palin
p.s. I see there is another question here like this and tried to expand on it in that thread, but was deleted by a moderator and told to post a new question.