GMan Well-Known Member Licensed User Longtime User May 2, 2014 #1 Hoi, i want to count decimals (here money), but got always erros. it should simply add the lblPreis.Text(LabelText= i.e. 3.20) to Bestellsumme (Double= i.e. 2.20) Here is the code i am using: Code: Copy Dim Bestellsumme as Double lblPreis.Text= NumberFormat2(lblPreis.Text,0,2,2,False) Bestellsumme = NumberFormat2(Bestellsumme,0,2,2,False) Bestellsumme = Bestellsumme + lblPreis.Text lblSumme.Text = Bestellsumme lblSumme.Visible = True The error message is: java.lang.NumberFormatException: Invalid double:"3.20" Click to expand... I tried around, but without knownledge its only try-and-error
Hoi, i want to count decimals (here money), but got always erros. it should simply add the lblPreis.Text(LabelText= i.e. 3.20) to Bestellsumme (Double= i.e. 2.20) Here is the code i am using: Code: Copy Dim Bestellsumme as Double lblPreis.Text= NumberFormat2(lblPreis.Text,0,2,2,False) Bestellsumme = NumberFormat2(Bestellsumme,0,2,2,False) Bestellsumme = Bestellsumme + lblPreis.Text lblSumme.Text = Bestellsumme lblSumme.Visible = True The error message is: java.lang.NumberFormatException: Invalid double:"3.20" Click to expand... I tried around, but without knownledge its only try-and-error
klaus Expert Licensed User Longtime User May 2, 2014 #2 This is wrong! Code: Copy Bestellsumme = NumberFormat2(Bestellsumme,0,2,2,False) NumberFormat2 returns a String not a Double. You should calculate with numbers and use NumberFormat2 only for dispaly. Upvote 0
This is wrong! Code: Copy Bestellsumme = NumberFormat2(Bestellsumme,0,2,2,False) NumberFormat2 returns a String not a Double. You should calculate with numbers and use NumberFormat2 only for dispaly.
LucaMs Expert Licensed User Longtime User May 2, 2014 #3 Bestellsumme = Bestellsumme + lblPreis.Text private Preis as double = lblPreis.Text Bestellsumme = Bestellsumme + Preis Upvote 0
Bestellsumme = Bestellsumme + lblPreis.Text private Preis as double = lblPreis.Text Bestellsumme = Bestellsumme + Preis
GMan Well-Known Member Licensed User Longtime User May 2, 2014 #4 I now changed to: Code: Copy Private Preis As Double = lblPreis.Text Bestellsumme = Bestellsumme + Preis lblSumme.Text = Bestellsumme lblSumme.Visible = True but the error is the same ?! Upvote 0
I now changed to: Code: Copy Private Preis As Double = lblPreis.Text Bestellsumme = Bestellsumme + Preis lblSumme.Text = Bestellsumme lblSumme.Visible = True but the error is the same ?!
GMan Well-Known Member Licensed User Longtime User May 2, 2014 #5 Got it - the Format of the Double is not guilty. As i am using the comma-seperator, but the double uses the dot-seperator, i had to add simply the following: Code: Copy lblPreis.Text = lblPreis.Text.Replace(".", "").Replace(",", ".") = THIS was missing Private Preis As Double = lblPreis.Text Bestellsumme = Bestellsumme + Preis lblSumme.Text = Bestellsumme lblSumme.Visible = True Upvote 0
Got it - the Format of the Double is not guilty. As i am using the comma-seperator, but the double uses the dot-seperator, i had to add simply the following: Code: Copy lblPreis.Text = lblPreis.Text.Replace(".", "").Replace(",", ".") = THIS was missing Private Preis As Double = lblPreis.Text Bestellsumme = Bestellsumme + Preis lblSumme.Text = Bestellsumme lblSumme.Visible = True