Microsoft
Software
Hardware
Network
Question : String.Format not working when using Label Text
I have the following code which I am using to display calculated averages into various labels. When I use the String.Format to control the display of decimal places it has no effect and displays numbers with several numbers to the right of the decimal point.
Example. It will display 266.167689999999 where I want it to only display 266.17
Here is the code to populate the Labels:
//***** divide Total by count to get average ********
decimal lodgingAdvAvg = lodgingAdvTotal / lodgingAdvCount;
//****** Display Results on Label Text and format to 2 decimal points ***********
lblLodgingAdv.Text = String.Format("{0:d}", lodgingAdvAvg.ToString());
Answer : String.Format not working when using Label Text
try this in between:
Math.Round(lodgingAdvAvg,2
);
Random Solutions
Wireless LAN , Larger Scale
Windows Service crashing on one machine, not on the other
Question for OWA
Unable to issue commands to Tivoli Storage Manager 6.1 Server using the Administration Center Console
IPTV programming dominating programming language
Java Open Source Barcode Software
import emal from and to Thunderbird
External Monintor won't work w/ Toshiba laptop; it USED to; fn (f5) doesn't "stick"
Attempted an unsupported operation
Serious logon issue