0

Ingreso una operación donde ingreso 0.25 pero me da por respuesta 25.0 , por lo tanto no puedo guardarlo en la base de datos

 Private Sub btningresar_Click(sender As Object, e As EventArgs) Handles btningresar.Click
        tara = CDbl(LblIndicador2.Text)
        PB = CDbl(lblindicador.Text)
        'Calcular el peso:
        PN = Convert.ToDouble(PB - tara)
4
Contributors
3
Replies
23
Views
2 Months
Discussion Span
Last Post by happygeek
2

We are an English-only community. Can you please post your question in English so that we can help you? Thanks!

1

Your language uses "," as decimal separator and "." as thousand separator and that is why instead of retrieving 1/4 (=0.25), CDbl is getting 25. Use double.parse instead, setting the NumberFormat you need:

        Dim ni As Globalization.NumberFormatInfo = Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone
        ni.NumberDecimalSeparator = "."
        tara = Double.Parse(lblindicador2.Text, ni)
        PB = Double.Parse(lblindicador.Text, ni)
0

Seeing as someone has been kind enough to answer the question despite it not being in Engliah, here's the Google Translate version (for which I cannot be held responsible regarding accuracy...)

"Join one operation where income 0.25 but I get to answer 25.0 , by so much not I can save it in the database of data "

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.