I'm developing a calculator in C# and I ran into a stumbling block. As usual calculators do, I have my text box set to RightToLeft. However, when I convert the number to a negative number using my + - button, the negative sign always goes to the RIGHT of the number, not the left. How do I make it appear on the left side using a right to left box?
My negative converter:
decimal neg;
neg = number * 2;
number = number - neg;
richTextBox1.Text = Convert.ToString(number);
As usual calculators do, I have my text box set to RightToLeft.
No, that’s not what usual calculators do. Set TextAlign
instead. (And use a regular TextBox
, not a RichTextBox
. RichTextBox
es are hard to format, but you can select the entire thing and use SelectionAlignment
if you really need to.)
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