formatting number in vb.net 2010 -


im using code formatting textbox.

public function textformat(byval sstring string) string         dim num1 decimal         try             num1 = convert.todecimal(sstring)             textformat = formatnumber(num1, 2)             return textformat         catch             textformat = sstring         end try     end function 

-the problem rounding off number input .. sample

textbox.text = "5999.99" displaying "6000.00" how can disable auto rounding off number . or there other code formatting text? "###,###,###.##" << should this

thanks

use tostring instead formatnumber.

public function textformat(byval sstring string) string     dim num1 decimal     if double.tryparse(sstring, num1)         return num1.tostring("g") ' or tostring("f2") or tostring("0.00")      else         return sstring     end if end function 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

html - Repeat image to extend header to fill screen -

javascript - Backbone.js getting target attribute -