Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共5 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:列拆分

1楼
fangshen 发表于:2025/2/25 9:22:00
各位大侠:我希望实现如下功能

在”表“,有A列,B列,C列,D列,希望把   A列  的字符根据   |   拆分到B列,C列,D列
例子:A列  的内容   中国|上海|青浦
        希望拆分成   B列=中国,C列=上海,D列=青浦

谢谢
2楼
有点蓝 发表于:2025/2/25 9:43:00
http://www.foxtable.com/webhelp/topics/0625.htm

DataColChanged事件
If e.DataCol.Name = "A列" Then
    
If e.NewValue > "" Then 
      dim ss() as string = 
e.NewValue.split("|") 'http://www.foxtable.com/webhelp/topics/0245.htm
 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编辑过]
3楼
fangshen 发表于:2025/2/26 12:47:00
把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

4楼
y2287958 发表于:2025/2/26 13:20:00
上文件
5楼
有点蓝 发表于:2025/2/26 13:28:00
http://www.foxtable.com/webhelp/topics/0324.htm

dim d as double
if double.TryParse(ss(0), d)
e.DataRow("B列") = d
end if
共5 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .04297 s, 2 queries.