how to get the last two digit from the number? [Resolved]

Posted by Vforvijay under VB.NET on 4/18/2011 | Points: 10 | Views : 9038 | Status : [Member] | Replies : 3
hi.....in this number 746,046.00 i need to get the last two digit..i.e 00
how can i achieve this in vb.net




Responses

Posted by: Ndebata on: 4/18/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi Vijay,

In which format you are storing this number, What I mean you are storing it as a string you can use
c#
string st = "46.00";

string s=st.Substring(st.IndexOf('.')+1);

VB.Net

Dim st as String="46.00"
Dim Lastdgt as String=st.Substring(st.IndexOf(".")+1);


if you are storing in a double

 

double d = 46.00;
string st1 = String.Format("{0:0.00}", d);
string s=st1.Substring(st.IndexOf('.')+1);


in VB.Net
 


Dim d as Double =46.00
Dim st as String=[String].Format("{0:0.00}", d)
Dim Lastdgt as String=st.Substring(st.IndexOf(".")+1);



Thanks,
Debata

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 4/18/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks For your reply.......
http://http://vbdotnetaddict.blogspot.com

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Plhkrishna on: 4/25/2012 [Member] Starter | Points: 25

Up
0
Down
String.Format("{0:my number is 0.0}", 12.3); // "my number is 12.3"

.net developer

Vforvijay, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response