以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 单元格字符串怎么赋值给数组呢? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=126702) |
-- 作者:hc-mall -- 发布时间:2018/10/26 17:40:00 -- 单元格字符串怎么赋值给数组呢? 我单元格的字符串是这样的"sp001","sp002","sp003","sp004","sp005","sp006","sp007","sp008","sp009","sp004" 赋值给数组后 Dim cpids() As String = {(e.Row("用料产品编号")) } 输出 MessageBox.show(cpids.Length) 数组的长度只有1,是我赋值的时候代码有错误吗? 这样明显是10个值啊! |
-- 作者:hc-mall -- 发布时间:2018/10/26 17:53:00 -- 我在命令窗口 Dim cpids() As String = {"sp001","sp002","sp003","sp004","sp005","sp006","sp007","sp008","sp009","sp004"} MessageBox.show(cpids.Length) 输出长度就是10
|
-- 作者:hc-mall -- 发布时间:2018/10/26 18:31:00 -- 解决了,方法如下: Dim cpid As String = e.Row("用料产品编号")Dim cpids() As String = cpid.Split(",") MessageBox.show(cpids.Length) 这样输出长度就是10了,自力更生了! |