怎样才能保证在DBGRID栅格中只能输入数字,并且数字要有两位小数,数字位数不能超过10位(包括小数)

解决方案 »

  1.   

    procedure TFrmBudgeMge.EdtBudgetYearKeyPress(Sender: TObject;
      var Key: Char);
    begin
      if not (key in ['0'..'9',#8]) then key:=#0;      //只能输入数字
      if not (key in ['0'..'9',#46,#8]) then key:=#0;  //只能输入数字和小数点
      if not (key in ['a'..'z','A'..'Z']) then key:=#0;//只能输入字母
    end;FormatFloat(0.00,v);
      

  2.   

    在关联字段的字段属性中设置EditFormat:='#.00'.数字位数不能超过10位(包括小数):写个算法来判别 一下。
      

  3.   

    同意 : linzer(阿色)的做法
    来晚了  hoho