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
web design vs dev
WebService Client problem
Air 2.0: 306 Error/ Native Process Not Supported Error
Is there any way to limit what the users see in shared calendars in Exchange 2003 / Exchange 2007?
Microsoft WORD doesnt open full screen
Change key default value by script
look up table value with sql
The SELECT permission was denied on the object 'sysdtspackages90', database 'msdb', schema 'dbo'.
Sharing camcorder footage
Login to SSRS as andmistrator rather than anonymous user.