vb.net - how do I parse a percentage value from a grid cell?

Posted by Bob Palin on Stack Overflow See other posts from Stack Overflow or by Bob Palin
Published on 2011-03-12T23:49:44Z Indexed on 2011/03/13 0:10 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about parsing