delphi实例TDBGrid用右键菜单复制行粘贴行 这个从本质上来说就是DBGrid后台数据库的插入 右键复制当前行的相关数据到临时变量点粘贴时,覆盖数据或插入数据! db为数据库: 字段名id,name,string型通过adoquery->datasource->dbgrid,adoquery的SQL中填写select * from db在form定义两个变量(全局):var id,name:string;复制代码:procedure CopyToMem;begin if not ado
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in [ '.',#8]) then key:=#0; //只能输入小数点end; procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in [ ' 0'..'9',#8]) then key:=#0; //只能输入数字en
(* 一般的清空combobox方法 combobox1.clear; ... combobox9.clear; *) procedure TForm1.Button1Click(Sender: TObject); var i: integer; begin for i:=0 to self.ComponentCount-1 do begin if self.Components[i] is TCombobox then TCombob
self.ADOQuery2.Edit;self.ADOQuery2.First;while not self.ADOQuery2.Eof dobeginself.ADOQuery2.FieldByName('单价').Value:=roundto(self.ADOQuery2.FieldByName('单价').Value,-2);self.ADOQuery2.Next;end;self.ADOQuery2.Post;这是显示在一个DBGrid里面我是想把单价保留2位小数,但是老出现这个问题,
//参考如下代码--uses Clipbrd; function StringGridSelectText(mStringGrid: TStringGrid): string;var I, J: Integer; S: string;begin Result := ''; if not Assigned(mStringGrid) then Exit; for J := mStringGrid.Selection.Top to mStringGrid.Selection.Bottom d
使用这种功能必须使用 OnKeyPress 事件,该事件是在窗体中获得键盘输入的焦点,并且在用户按键时发生.OnKeyPress 事件中有个重要参数:Key.Key 参数为Char 型,它能够获得用户的按键值.下面的代码就只能输入0~9 之间的数字,且只能输入一个小数点,按下其他键时无效. procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin ]) then key:=#; ) then key:=#; end