How to convert Decimal result into Integer using C# in ASP.Net

Last Reply one year ago By YacharuP

Posted one year ago

hi

see below code:

LblResult.Text = (Convert.ToDouble(Lblcredit.Text) / Convert.ToDouble(12.9)).ToString();

when I run this code result is:

Lblresult.Text=567.123658596

 

I want it display in integer like

567

How I can convert it?

Best regards

neda

Posted one year ago
nedash says:
LblResult.Text = (Convert.ToDouble(Lblcredit.Text) / Convert.ToDouble(12.9)).ToString();

 Replace above code with below.

LblResult.Text = Convert.ToInt32((Convert.ToDouble(Lblcredit.Text) / Convert.ToDouble(12.9))).ToString();