I am at the beginning of a steep learning curve with Vc++ (C++/CLI)
How do you format text (numbers) in a text box on a form?
printf() was easy, in the good old days 😉
The following works but there are lots of decimal places.
I only need to display one decimal point.
that is 22.4 not 22.4178301
//Calculate the Power and current
fPower2 = (pow((fVoltagePkPk * 0.5 * 0.707),2) / 2);
fCurrent2 = fPower2 / (fVoltagePkPk * 0.5 * 0.707);
//Display the Power amd current in the text boxes
txtPower2->Text = Convert::ToString(fPower2);
txtCurrent2->Text = Convert::ToString(fCurrent2);
Thanks
You can use
The F1 refers to 1 fixed digit. See http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx#Y2205 for more formatting options.