I've got a combo box with a set of values( 5, 10,15, 20).
When the user goes to select a value I want them to appear as percentages (5%, 10%, 15%, 20%).
I was playing with format string using a value of ##% but that did not work.
FormatString should work, but it will multiply the number by 100. Probably want to add a 0 in front of your string to handle 0%.
This code worked for me.
private void Form1_Load(object sender, EventArgs e)
{
this.comboBox1.FormatString = "##0%";
comboBox1.Items.Add(0);
comboBox1.Items.Add(0.33);
comboBox1.Items.Add(0.50);
comboBox1.Items.Add(0.67);
comboBox1.Items.Add(1);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With