各位大侠:我希望实现如下功能
在”表“,有A列,B列,C列,D列,希望把 A列 的字符根据 | 拆分到B列,C列,D列
例子:A列 的内容 中国|上海|青浦
希望拆分成 B列=中国,C列=上海,D列=青浦
谢谢
http://www.foxtable.com/webhelp/topics/0625.htm
DataColChanged事件
e.DataRow("B列") = ss(0)
if ss.length > 1 then
e.DataRow("C列") = ss(1)
end if
if ss.length > 2 then
e.DataRow("D列") = ss(2)
end if
End If
End If
已有数据在输入表事件代码后,重置一下A列
[此贴子已经被作者于2025/2/25 9:43:42编辑过]
把A列通过|分隔符拆分B列,C列,D列,如下代码可以实现,
但是B列,C列,D列设置的都是双精度小数,而A列是通过视觉识别的,所以可能会有非数值的内容,所以能否判断一下,如果拆分出来的有非双精度小数的,就不要执行给B列,C列,D列
谢谢
If e.DataCol.Name = "A列" Then
If e.NewValue > "" Then
dim ss() as string = e.NewValue.split("|")
e.DataRow("B列") = ss(0)
if ss.length > 1 then
e.DataRow("C列") = ss(1)
end if
if ss.length > 2 then
e.DataRow("D列") = ss(2)
end if
End If
End If
http://www.foxtable.com/webhelp/topics/0324.htm
dim d as double
if double.TryParse(ss(0), d)
e.DataRow("B列") = d
end if