I want to change the text of label1 by multiplying query field with value of spinBox1. But it doesn't work. ** Fields[3] saved as Integer in my table **
label1.Text := MSQuery1.Fields[3].AsInteger * spinBox1.Value;
or
label1.Text := MSQuery1.Fields[3].AsInteger * spinBox1.Text.ToInteger;
Assuming:
Label1.Text
is okay, else you need Label1.Caption
Value
type is Double
, not an Integer
The code is:
Label1.Text := (MSQuery1.Fields[3].AsInteger * SpinBox1.Value).ToString;
// Or using older versions of Delphi
Label1.Text := FloatToStr(MSQuery1.Fields[3].AsInteger * SpinBox1.Value);