Jump to content

[Resolvido] Calcular entre labels


vascoc
 Share

Recommended Posts

Boas, eu tenho um form que calcula os preços, a questão é, o preço da noite no quarto multiplica pelo numero de noites, mas gostava que fica-se com ",00" á frente também quando o valor não tem casas décimais... por exemplo nesta caso ficaria "1600,00"

http://img708.imageshack.us/img708/1056/ddddhp.png



' TIMER PREÇOS
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim extra1 As Integer
Dim pensao As Integer

'Dias
If dias_Reserva.Text = "" Then
Else
Data_SaídaDateTimePicker.Visible = True
Data_SaídaDateTimePicker.Value = Data_EntradaDateTimePicker.Value.AddDays(dias_Reserva.Text)
Precodormida.Text = dias_Reserva.Text * Preco_Tipo_QuartoLabel1.Text
End If

'Pensao
If Tipo_PensaoComboBox.Text = "" Then
Else
pensao = Double.Parse(lblprecopensao.Text)
lbltotal.Text = Precodormida.Text + pensao
End If
Data_SaídaDateTimePicker.Update()

'Extras
If Cod_ExtrasComboBox.Text = "" Then 'Extra1
Else
extra1 = Integer.Parse(lblextra1.Text)
pensao = Double.Parse(lblprecopensao.Text)
lbltotal.Text = Precodormida.Text + extra1 + pensao
Preco_ExtrasLabel1.Text = extra1
lbltotal.Text = Precodormida.Text
End If

End Sub
Edited by Caça
GeSHi
Link to comment
Share on other sites

Vê a função FormatNumber

Já testei com estes e não cheguei nada, mas de certeza que tenho algo mal...

lbltotal.Text = FormatCurrency("00")
Round(lbltotal.Caption, 2)
Format(lbltotal.Caption, "#.00")
lbltotal.Text = Format(lbltotal.Text , "Currency")
Edited by Caça
GeSHi
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.