以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]数据绑定  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=187711)

--  作者:riyuan
--  发布时间:2023/8/6 10:25:00
--  [求助]数据绑定
为什么在表的currentchanged事件中写的代码如下:

  For Each dr As DataRow In dt.DataRows
    e.Form.Controls("label11").Text = dt.DataRows(0)("姓名")
      Next
在单击表某一行的时候,该字段不能显示到label11上。

--  作者:有点蓝
--  发布时间:2023/8/6 20:14:00
--  
先看看:http://www.foxtable.com/webhelp/topics/2925.htm

代码改为
If e.Table.Current Is Nothing Then \'如果Current为Nothing
    Return \'则返回
End
 If
e.Form.Controls("label11").Text = e.Table.Current("姓名")