I have multiple textboxes left-aligned vertically. They show numbers with floating points and signs. The numbers are continuously changing. I\'d like to make the position of the
Have you tried String.Format?
String.Format("{0:0.0000}", 123.4567); //will return "123.4567"
String.Format("{0:0.0000}", 123.45678); //will return "123.4568"
This should do the trick:
textbox1.Text = String.Format("{0,10:+0.00000;-0.00000}", number1);
textbox2.Text = String.Format("{0,10:+0.00000;-0.00000}", number2);
textbox3.Text = String.Format("{0,10:+0.00000;-0.00000}", number3);
textbox4.Text = String.Format("{0,10:+0.00000;-0.00000}", number4);
textbox5.Text = String.Format("{0,10:+0.00000;-0.00000}", number5);
or this if you want the sign symbol before the padding.
textbox1.Text = String.Format("{0:+;-}{0,9:0.00000;0.00000}", number1);
textbox2.Text = String.Format("{0:+;-}{0,9:0.00000;0.00000}", number2);
textbox3.Text = String.Format("{0:+;-}{0,9:0.00000;0.00000}", number3);
textbox4.Text = String.Format("{0:+;-}{0,9:0.00000;0.00000}", number4);
textbox5.Text = String.Format("{0:+;-}{0,9:0.00000;0.00000}", number5);