以文本方式查看主题

-  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=8298)

--  作者:飞鱼
--  发布时间:2010/9/29 11:57:00
--  [求助]如何同时清除多列的内容?
在datacolchanged事件中,如果一个datarow中有10多个列,只想保留一列的内容,清除其他所有列,我现在是一个一个使用"=Nothing",比如,dr("a")=nothing,dr("b")=nothing,.......,觉得麻烦,于是自己试了下dr("a","b","c","d")=nothing,提示错误,有没有方便的办法?
--  作者:mr725
--  发布时间:2010/9/29 12:23:00
--  

for each c as datacol in datatables("ttt").datacols

  currenttable.current(c.name) = nothing

next


--  作者:飞鱼
--  发布时间:2010/9/29 12:29:00
--  
以下是引用mr725在2010-9-29 12:23:00的发言:

for each c as datacol in datatables("ttt").datacols

  currenttable.current(c.name) = nothing

next

这样不是把所有的列内容都清了么?可我想保留其中一列呢.


--  作者:czy
--  发布时间:2010/9/29 12:43:00
--  

加个判断不就行了。

if c.name  <> "某列"

currenttable.current(c.name) = nothing

end if