Jump to content

Dividir R$ por Quantidade


williamjda
 Share

Recommended Posts

Amigos tenho uma questão. Estou a dividir um campo onde o valor é em real por uma certa quantidade.

EXEMPLO:

15,97 / 7 = 2,28142857142857

Porem gostaria que o resultado aparecesse desta forma;

2,28

Se eu divido 50,00 / 1 = 50

Porem gostaria que o resultado aparecesse desta forma;

50,00

Sempre conservando duas casas decimais depois da virgula.

Private Function GetValueVirgula(Value As String) As Decimal
       Value = Value.Replace(",", Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)
       Return Decimal.Parse(Value)
   End Function

txtvalorUnitarioComponente.Text = GetValueVirgula(txtvalorTotalUnidadeFechada.Text) / Val(txtqtdUnidadeFechadaAdquerida.Text)

Como posso corrigir essa questão?

Edited by williamjda
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.