I´m trying to parse a String to a Decimal but I keep getting a formatException
Dim row as GridViewRow
for each row in grdActieRittenActiefAlt.rows
Dim rbl as RadioButtonList = row.FindControl("tblAddAct")
'toevoegen = true
if rbl.SelectedItem.Value = true then
Dim opgaveIdent as Integer = Convert.ToInt32(grdActieRittenActiefAlt.DataKeys(row.RowIndex).Value.ToString())
Dim curOldTarief as Decimal = Convert.ToDecimal(lblCuratiefTarief.Text)
Dim curOldKorting as Decimal = Convert.ToDecimal(lblCuratiefKorting.Text)
Dim curTariefString as String = row.Cells(4).Text
Dim curKortingString as String = row.Cells(6).Text
Dim curTarief as Decimal = Convert.ToDecimal(curTariefString)
Dim curKorting as Decimal = Convert.ToDecimal(curKortingString)
lblCuratiefTarief.Text = (curOldTarief + curTarief).ToString()
lblCuratiefKorting.Text = (curOldKorting + curKorting).ToString()
end if
next row
The input is 431,25.
So far I've tried the following:
Does anyone else have any suggestions?
After doing a lot more testing and trying I've found a workaround/solution for the problem.
The row.Cells(4).Text was a boundfield. I've changed that to a TemplateField with a label. By making a local variable (Label) and using that to convert the decimal from it works. I got no idea why but for me it's a solution for now.