如何通过编程方式对表单表格的第1列text1控件的dblclick事件编写命令程序?

ZJM811192 2018-08-21 10:30:48
我以编程命令方式在表单中按下指定命令钮后会产生一个Grid表格,所编程序为:

thisform.grid1.recordsource="商品销售"
thisform.grid1.ColumnCount=6
thisform.grid1.column1.controlsource='商品销售.编号'
thisform.grid1.column2.controlsource='商品销售.销售日期'
thisform.grid1.column3.controlsource='商品销售.商品名'
thisform.grid1.column4.controlsource='商品销售.单位'
thisform.grid1.column4.controlsource='商品销售.数量'
thisform.grid1.column6.controlsource='商品销售.销售价'
thisform.grid1.column1.header1.caption='编号'
thisform.grid1.column2.header1.caption='销售日期'
thisform.grid1.column3.header1.caption=''商品名'
thisform.grid1.column4.header1.caption='单位'
thisform.grid1.column5.header1.caption='数量'
thisform.grid1.column6.header1.caption='销售价'
thisform.grid1.column1.width=80
thisform.grid1.column2.width=120
thisform.grid1.column3.width=120
thisform.grid1.column4.width=50
thisform.grid1.column5.width=20
thisform.grid1.column6.width=30

现在需要在该表格的第1列text1控件的dblclick事件编写如下命令程序,并加入到以上程序中:

thisform.container1.text1.Value=商品销售.编号
thisform.container1.text2.Value=商品销售.销售日期
thisform.container1.text3.Value=商品销售.商品名
thisform.container1.text4.Value=商品销售.数量
thisform.container1.text5.Value=商品销售.销售价

敬向电脑专家请教,如何通过编程方式对表单表格的第1列text1控件的dblclick事件编写命令程序?敬请批导,不胜感激!

...全文
1329 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
WMERP 2018-09-07
  • 打赏
  • 举报
回复
https://wenku.baidu.com/view/6de3e619960590c69fc37677.html 参考下bindevent()
ZJM811192 2018-09-05
  • 打赏
  • 举报
回复
我以编程命令方式在表单中按下指定命令钮后会产生一个Grid表格。

现在需要所产生的表格中具有一个功能:双击该表格的其行第1列,会在表单中的指定的文本框中显示表格这一行的字段数据。
于是,我中添加了以下程序:

procedure thisform.grod1.column1.text1.dblclicK
thisform.container1.text1.Value=商品销售.编号
thisform.container1.text2.Value=商品销售.销售日期
thisform.container1.text3.Value=商品销售.商品名
thisform.container1.text4.Value=商品销售.数量
thisform.container1.text5.Value=商品销售.销售价
endproc

但在运行时,电脑却出现了出错提示,指出:procedure thisform.grod1.column1.text1.dblclick命令中含有不能识别的短语或关键字。
敬向电脑专家请教,如何通过编程方式对表单表格的第1列text1控件的dblclick事件编写命令程序?敬请批导,不胜感激!
WMERP 2018-09-03
  • 打赏
  • 举报
回复
procedure thisform.grod1.column1.text1.dblclic
写错了吧,少了个字母 k
procedure thisform.grod1.column1.text1.dblclick
ZJM811192 2018-09-02
  • 打赏
  • 举报
回复
十豆三老师:
过去,我有很多问题多次向您请教,受益非浅,非常感谢!
这次又向您请教一个问题,耽搁您宝贵的时间。
我以编程命令方式在表单中按下指定命令钮后会产生一个Grid表格,所编程序为:

thisform.grid1.recordsource="商品销售"
thisform.grid1.ColumnCount=6
thisform.grid1.column1.controlsource='商品销售.编号'
thisform.grid1.column2.controlsource='商品销售.销售日期'
thisform.grid1.column3.controlsource='商品销售.商品名'
thisform.grid1.column4.controlsource='商品销售.单位'
thisform.grid1.column4.controlsource='商品销售.数量'
thisform.grid1.column6.controlsource='商品销售.销售价'
thisform.grid1.column1.header1.caption='编号'
thisform.grid1.column2.header1.caption='销售日期'
thisform.grid1.column3.header1.caption=''商品名'
thisform.grid1.column4.header1.caption='单位'
thisform.grid1.column5.header1.caption='数量'
thisform.grid1.column6.header1.caption='销售价'
thisform.grid1.column1.width=80
thisform.grid1.column2.width=120
thisform.grid1.column3.width=120
thisform.grid1.column4.width=50
thisform.grid1.column5.width=20
thisform.grid1.column6.width=30

现在需要在所编表格中具有一个功能:双击该表格的其行第1列,会在表单中的指定的文本框中显示表格这一行的字段数据。
于是,我在上面的程度中添加了以下程序:

procedure thisform.grod1.column1.text1.dblclic
thisform.container1.text1.Value=商品销售.编号
thisform.container1.text2.Value=商品销售.销售日期
thisform.container1.text3.Value=商品销售.商品名
thisform.container1.text4.Value=商品销售.数量
thisform.container1.text5.Value=商品销售.销售价
endproc

但在运行时,电脑却出现了出错提示,指出:procedure thisform.grod1.column1.text1.dblclic命令中含有不能识别的短语或关键字。
敬向您请教,如何通过编程方式对表单表格的第1列text1控件的dblclick事件编写命令程序?敬请批导,不胜感激!
lzw_0736 2018-09-01
  • 打赏
  • 举报
回复
这个需要动态绑定代码
WMERP 2018-08-30
  • 打赏
  • 举报
回复
或者定义一个字符串也可以
用字符串执行命令
比如定义一个全局或者private 字符串数b
DBclick()事件写:
if b<>''
&b
end if
然后在其他代码处写

b="thisform.container1.text1.Value='商品销售.编号'"+chr(13)+"thisform.container1.text2.Value='商品销售.销售日期'"+chr(13)+"thisform.container1.text3.Value='商品销售.商品名'"+chr(13)+"thisform.container1.text4.Value='商品销售.数量'"+chr(13)+"thisform.container1.text5.Value='商品销售.销售价'"

这样DbCLIck就可以执行了
WMERP 2018-08-30
  • 打赏
  • 举报
回复
用字符串执行命令
比如定义一个全局或者private 字符串数组a(100)
再DBclick()事件写:
for i=1 to 100
if a(i)<>''
&a(i)
end if
end for

然后在其他代码处写
for i=1 to 100
a(i)=''
end for
a(1)="thisform.container1.text1.Value='商品销售.编号'"
a(2)="thisform.container1.text2.Value='商品销售.销售日期'"
a(3)="thisform.container1.text3.Value='商品销售.商品名'"
a(4)="thisform.container1.text4.Value='商品销售.数量'"
a(5)="thisform.container1.text5.Value='商品销售.销售价'"

这样DbCLIck就可以执行了

2,723

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧