How to display a double value as text in a CEdit window
-
Does anyone have a suggestion as to how to convert a double value to text so it can be displayed in a CEdit window? Thanks.
John P.
-
Does anyone have a suggestion as to how to convert a double value to text so it can be displayed in a CEdit window? Thanks.
John P.
Since you are using MFC, try:
CString str;
str.Format("%f", 123.45);
m_edit.SetWindowText(str);Or:
char szStr[16];
sprintf(szStr, "%f", 123.45);
m_edit.SetWindowText(szStr);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Since you are using MFC, try:
CString str;
str.Format("%f", 123.45);
m_edit.SetWindowText(str);Or:
char szStr[16];
sprintf(szStr, "%f", 123.45);
m_edit.SetWindowText(szStr);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Thanks, David --- you da man!
John P.
-
Does anyone have a suggestion as to how to convert a double value to text so it can be displayed in a CEdit window? Thanks.
John P.
-
Since you're usimg MFC, just associate a double variable instead of a string with the windows. DDX will handle the conversions for you. Judy
Thanks, Judy. I was not aware of that. That is very useful to know. I appreciate your response.
John P.