-
October 1st, 2024, 11:33 PM
#16
Re: MFC Combobox in visual studio 2022
To display negative floats correctly in an MFC ComboBox (TComboBox) in Visual Studio 2022, you should ensure that the string representation of the number is formatted properly before adding it to the ComboBox. Instead of adding the string as "-6", format it using CString or similar methods to ensure the negative sign appears correctly. Here?s an example of how to do this:
CString negativeFloat;
negativeFloat.Format(_T("%.2f"), -6.0); // Adjust the format as needed
yourComboBox.AddString(negativeFloat);
This will add the string representation of -6.00 to the ComboBox, ensuring it displays correctly as -6 instead of 6-.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|