Jump to content

Nao consigo guardar os zeros


andrejkl
 Share

Recommended Posts

Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click
	Dim final As Double
	final = CDbl(valor1.Text) + CDbl(valor2.Text) + CDbl(valor3.Text) + CDbl(valor4.Text) + CDbl(valor5.Text) + CDbl(valor6.Text)
	resultado.Text = final.ToString("##,##0.00")
End

Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
	Try
		RecibosTableAdapter.Modificar(TextBox2.Text, TextBox5.Text, TextBox1.Text, TextBox4.Text, preço1.Text, quant1.Text, CDbl(valor1.Text), TextBox6.Text, preço2.Text, quant2.Text, CDbl(valor2.Text), TextBox7.Text, preço3.Text, quant3.Text, CDbl(valor3.Text), TextBox8.Text, preço4.Text, quant4.Text, CDbl(valor4.Text), TextBox9.Text, preço5.Text, quant5.Text, CDbl(valor5.Text), TextBox10.Text, preço6.Text, quant6.Text, CDbl(valor6.Text), CDbl(resultado.Text), Extenso.Text, TextBox3.Text, TextBox2.Text)
		RecibosTableAdapter.Fill(Centro_SocialDataSet.Recibos)
		MessageBox.Show("guardado")
	Catch ex As Exception
		MessageBox.Show("Erro ao guardar")
	End Try
End Sub

Quando eu tento guardar 4,50 ele arredonda para 4,5, alguem consegue-me resolver isso

ja tentei por decimal nao resulta

Edited by apocsantos
geshi
Link to comment
Share on other sites

Dim p2, q2 As Decimal
	Dim soma2 As Decimal
	q2 = quant2.Text
	p2 = preço2.Text
	p2 = p2.ToString("###,##0.00")
	soma2 = q2 * p2
	valor2.Text = soma2.ToString("###,##0.00")
End Sub
Private Sub TextBox7_TextChanged(sender As Object, e As EventArgs) Handles preço3.TextChanged
	Dim p3, q3, soma3 As Double
	q3 = quant3.Text
	p3 = preço3.Text
	soma3 = q3 * p3
	valor3.Text = soma3.ToString("###,##0.00")
End Sub

Private Sub TextBox15_TextChanged(sender As Object, e As EventArgs) Handles preço4.TextChanged
	Dim p4, q4, soma4 As Double
	q4 = quant4.Text
	p4 = preço4.Text
	soma4 = q4 * p4
	valor4.Text = soma4.ToString("###,##0.00")
End Sub

Private Sub TextBox14_TextChanged(sender As Object, e As EventArgs) Handles preço5.TextChanged
	Dim p5, q5, soma5 As Decimal
	q5 = quant5.Text
	p5 = preço5.Text
	soma5 = q5 * p5
	valor5.Text = soma5.ToString("###,##0.00")
End Sub

Private Sub TextBox13_TextChanged(sender As Object, e As EventArgs) Handles preço6.TextChanged
	Dim q6, p6, soma6 As Decimal
	q6 = quant6.Text
	Format("#,###.00")
	p6 = preço6.Text
	soma6 = q6 * p6.ToString("#,###.00;(#,###.00)")
	valor6.Text = soma6.ToString("#,###.00;(#,###.00)")
End Sub

Private Sub preço_TextChanged(sender As Object, e As EventArgs) Handles preço1.TextChanged
	Dim q1, soma, p1 As Decimal
	q1 = quant1.Text
	p1 = preço1.Text
	p1 = p1.ToString("###,##0.00")
	soma = q1 * p1
	valor1.Text = soma.ToString("#,###.00;( #,###.00)")
End Sub
Edited by apocsantos
geshi
Link to comment
Share on other sites

Private Sub Button1_Click_2(sender As Object, e As EventArgs) Handles Button1.Click
	Dim final As Decimal
	final = CDec(valor1.Text) + CDec(valor2.Text) + CDec(valor3.Text) + CDec(valor4.Text) + CDec(valor5.Text) + CDec(valor6.Text)
	Me.Extenso.Text = NumberToEuro(Me.resultado.Text)
	resultado.Text = final.ToString("#,###.00;(#,###.00)")
End Sub
Edited by apocsantos
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.