请问:在DBGRID表格中,当Mouse点击任意行列时如何读出当前行某列字段内容?我在OnColEnter事件里写,却只要在不同列切换时才触发,如果在同一列点击却没有反应。 我的想法时不管点击哪列,都能读取这一行指定列的列的显示内容。谢了!
解决方案 »
- 自定义Font对话框
- 为什么用try...except无法立即测试出是否与远程数据库连接成功?
- 不好!Fastreport报表设主中,属性编辑器不见了。按F11也没用。急,如何调出来???
- 制作安装程序的问题!
- MDI应用程序中的问题
- 帮我看一下这一句,怎么会出错?!(在线)
- delphi为应用程序制作安装程序
- 24位BMP转为ARGB4444的算法讨论
- com+组件install出错!
- how to change the 'caption' of the pagecontrol control
- adoset 的reflesh 如何使用?
- 如何让Edit显示为空字符?(我是用ACCESS建的库)
Tinfo=record
colmn:integer;//列的序号
content:String;//当前行列的字段内容
end;声明:
info:Tinfo;在CellClick中如下就OK了,以后如果用到点击取得的内容,刚直接用 info.contentprocedure TForm1.DBGrid1CellClick(Column: TColumn);
var
str_content:string;
begin
str_content:=dbgrid1.DataSource.dataSet.fieldbyname(column.FieldName).AsString;
info.colmn:=column.ID;
info.content:=str_content;
ShowMessage(str_content);
ShowMessage(inttostr(info.colmn));
end;