I have a DBEdit control, connnected to an ADO record set displaying a floating point number. This number has been masked as a currency through the field editor of the record set. This causes a currency sign to be displayed at the front of the number, eg 1.5923432 -> £1.59. I'd like the user to be able to edit the number, and then click a button that pushes the edited number to the database. However, when I get the text content of the box (using strtofloat(DBEdit1.text)
) the result produces an error as the text of the dbedit does of course include the currency sign, so cannot be converted to a number.
How can I get the plaintext contents of the DBEdit, (without the currency symbol) without any masking? Would simply deleting the first character from the front of the string be an effective way to do it or is there a simpler way?
I figured it out. You can get the contents of a dbedit with no masking by using: DBEdit1.Field.AsReal
or DBEdit1.Field.AsInteger
This will give you the numerical value contained within the dbedit, with no currency signs or commas.