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)

Recommended Answers

All 3 Replies

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

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)

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 "

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.