下载了一个源码
procedure Tcgdd.DBGridEh1SetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
begin
Etxt := Value;
end;
procedure Tcgdd.DBGridEh1GetEditText(Sender: TObject; ACol, ARow: Integer;
var Value: string);
begin
ECol := ACol;
Ytxt := Value;
end;
procedure Tcgdd.ADOTable2jsSetText(Sender: TField; const Text: string);
begin
if ADOTable2.FieldByName('spname').asstring = '' then exit;
if Etxt = '' then Etxt := '0';//问题在这里
if ADOTable2.FieldByName('bzgg').Value > 0 then
begin
ADOTable2.FieldByName('sl').Value := ADOTable2.FieldByName('bzgg').Value * Etxt + ADOTable2.FieldByName('ss').Value;
ADOTable2.FieldByName('js').Value := Etxt;
end
else
begin
ADOTable2.FieldByName('sl').Value := Etxt + ADOTable2.FieldByName('ss').Value;
ADOTable2.FieldByName('js').Value := Etxt;
end;
ADOTable2.FieldByName('je').Value := ADOTable2.FieldByName('sl').Value * ADOTable2.FieldByName('dj').Value + ADOTable2.FieldByName('sl').Value * ADOTable2.FieldByName('dj').Value * ADOTable2.FieldByName('sui').Value / 100;
end;我修改了ADOTable2jsSetText对应的单元格数据后,当我用鼠标点击下一单元格时,刚修改的数据显示"0"跟踪后发现是这一句if Etxt = '' then Etxt := '0'设置的。但是我想不明白的是,我明明修改了数据,Etxt为什么还是空值?谢谢!!
procedure Tcgdd.DBGridEh1SetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
begin
Etxt := Value;
end;
procedure Tcgdd.DBGridEh1GetEditText(Sender: TObject; ACol, ARow: Integer;
var Value: string);
begin
ECol := ACol;
Ytxt := Value;
end;
procedure Tcgdd.ADOTable2jsSetText(Sender: TField; const Text: string);
begin
if ADOTable2.FieldByName('spname').asstring = '' then exit;
if Etxt = '' then Etxt := '0';//问题在这里
if ADOTable2.FieldByName('bzgg').Value > 0 then
begin
ADOTable2.FieldByName('sl').Value := ADOTable2.FieldByName('bzgg').Value * Etxt + ADOTable2.FieldByName('ss').Value;
ADOTable2.FieldByName('js').Value := Etxt;
end
else
begin
ADOTable2.FieldByName('sl').Value := Etxt + ADOTable2.FieldByName('ss').Value;
ADOTable2.FieldByName('js').Value := Etxt;
end;
ADOTable2.FieldByName('je').Value := ADOTable2.FieldByName('sl').Value * ADOTable2.FieldByName('dj').Value + ADOTable2.FieldByName('sl').Value * ADOTable2.FieldByName('dj').Value * ADOTable2.FieldByName('sui').Value / 100;
end;我修改了ADOTable2jsSetText对应的单元格数据后,当我用鼠标点击下一单元格时,刚修改的数据显示"0"跟踪后发现是这一句if Etxt = '' then Etxt := '0'设置的。但是我想不明白的是,我明明修改了数据,Etxt为什么还是空值?谢谢!!
procedure Tcgdd.DBGridEh1SetEditText(Sender: TObject; ACol, ARow: Integer;
const Value: string);
begin
Etxt := Value;
end;value的值可能是修改前的值吧,我的DBGridEh控件怎么没有这个事件啊。