vascoc Posted June 19, 2012 at 03:45 PM Report Share #464109 Posted June 19, 2012 at 03:45 PM (edited) 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 June 19, 2012 at 09:36 PM by Caça GeSHi Link to comment Share on other sites More sharing options...
jlpcalado Posted June 19, 2012 at 04:34 PM Report Share #464127 Posted June 19, 2012 at 04:34 PM Vê a função FormatNumber Link to comment Share on other sites More sharing options...
vascoc Posted June 19, 2012 at 05:11 PM Author Report Share #464139 Posted June 19, 2012 at 05:11 PM (edited) 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 June 19, 2012 at 09:36 PM by Caça GeSHi Link to comment Share on other sites More sharing options...
Andrepereira9 Posted June 19, 2012 at 07:57 PM Report Share #464206 Posted June 19, 2012 at 07:57 PM Boas Experimenta assim Label1.Text = FormatNumber(1600, 2) 'Onde 1600 é a variavel que tem o preço, e o 2 é a quantidade de 0 a seguir à virgula A informática chegou para resolver problemas que antes não existiam Quem ri por último é porque está conectado a 52 Kbs. Link to comment Share on other sites More sharing options...
vascoc Posted June 20, 2012 at 09:37 AM Author Report Share #464317 Posted June 20, 2012 at 09:37 AM Obrigado, resolvido ! 😄 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now