Jump to content

textbox aceitar moeda arredondada[RESOLVIDO]


j.mendes24
 Share

Recommended Posts

Utiliza o método Round da classe Math.

Math.Round(numero,casas_decimais) + 5 Overloads para outros casos específicos

        Dim valor As Double = 3.2355D
        MsgBox(valor.ToString)
        MsgBox(Math.Round(valor, 2).ToString)

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Link to comment
Share on other sites

obrigado, mas agr tenho outro problema.

eu pus este codigo:

ArtPrcUni = TXTArtPrcUni.Text
        ArtPrcUni = Math.Round(ArtPrcUni, 2).ToString
        MsgBox(ArtPrcUni)

mas se por exemplo o ArtPrcUni = 105,00 só aparece "105", se o ArtPrcUni´= 105.30 só aparece "105.3" se o ArtPrcUni= 0,00 só aparece "0" e eu quero que aparece sempre com duas casas decimais, ou seja, 105.00; 105.30 ou 0.00, respectivamente.

como resolvo a situação?

?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.