How to increment the number after the decimal point [Resolved]

Posted by balajirnaukri-12656 under ASP.NET on 1/30/2012 | Points: 10 | Views : 1490 | Status : [Member] | Replies : 2
I am having the version number number 1.0 if i ncrement i should get 1.1 and also if my version number is 1.25 i should get 1.26.can anyone help me regarding this

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp



Responses

Posted by: Pradeepkumar417 on: 1/31/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi,

This is the code for increment decimal point

decimal d = new Decimal(1.0);
int intPart = (int)d;
d = d % 1;
if (d != 0)
{
string str = Convert.ToString(d);
string[] str1 = new string[] { "." };
string[] str2 = new string[2];
str2 = str.Split(str1, StringSplitOptions.None);
int val = Convert.ToInt32(str2[1]) + 1;
d = Convert.ToDecimal(intPart.ToString() + "." + val);
}
else
{
d = Convert.ToDecimal(intPart.ToString() + "." + 1);
}


Thanks & Regards,
Pradeep Kumar,
Software Engineer.

Thanks & Regards,
Software Engineer,
Pradeep Kumar

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: balajirnaukri-12656 on: 1/31/2012 [Member] Starter | Points: 25

Up
0
Down
yeah thanks pradeep I did the same got it

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response