vb.net - Determine digits decimal point -


i working on simple vb.net application allows users enter decimal number (ex - 1.23) , program lists digits left , right of decimal , how many actual digits left , right of decimal. here code looks far.

dim imput string imput = txtenternumber.text dim d integer d = txtenternumber.text.indexof(".") txtnumleft.text = imput.remove(d) txtnumright.text = imput.remove(0, d) txtdigitleft.text = cstr(imput.substring(0, d).length) txtdigitright.text = cstr(imput.substring(d).length) 

when run program includes decimal point digits right of decimal , how many digits right of decimal. why this?

thanks!

try this

dim imput string imput = txtenternumber.text dim d integer d = txtenternumber.text.indexof(".") txtnumleft.text = imput.remove(d) txtnumright.text = imput.remove(0, d + 1) txtdigitleft.text = cstr(imput.substring(0, d).length) txtdigitright.text = cstr(imput.substring(d + 1).length) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -