vb listbox如何分行显示数据
一个字符串一共有163个数据,以“,”隔开的,用split把这个字符串分开后如何在listbox中一行显示20个数据呢?能写出具体程序吗?...
一个字符串一共有163个数据,以“,”隔开的,用split把这个字符串分开后如何在listbox中一行显示20个数据呢?能写出具体程序吗?
展开
2013-11-10
展开全部
dim temp as string '字符串
temp=... '假定 你以有的 163个数据
然后用 split 分隔开
dim s() as string
s = split (temp,",")
然后 再定义个变量
dim data as string
'163条 每行20条 需要9行
For i = 0 To 19
data =""
For j = 0 To 7
data = data & s(i + j * 20)
Next j
List1.AddItem data
Next i
''最后一行 是第 161 162 163 个数据
data = s(160) & s(161) & s(162) 's是数组 下标从0开始的
List1.AddItem data
temp=... '假定 你以有的 163个数据
然后用 split 分隔开
dim s() as string
s = split (temp,",")
然后 再定义个变量
dim data as string
'163条 每行20条 需要9行
For i = 0 To 19
data =""
For j = 0 To 7
data = data & s(i + j * 20)
Next j
List1.AddItem data
Next i
''最后一行 是第 161 162 163 个数据
data = s(160) & s(161) & s(162) 's是数组 下标从0开始的
List1.AddItem data
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-11-10
展开全部
Dim i As Integer
Dim k As Integer
Dim Str As String
Dim Tmp As String
Dim By() As String
Str = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21"
By = Split(Str, ",")
k = 1
For i = 0 To UBound(By) - 1
If Tmp = "" Then Tmp = By(i) Else Tmp = Tmp & "," & By(i) '这里我用,做分隔,你也可以改别的
k = k + 1
If k = 20 Or i = UBound(By) - 1 Then List1.AddItem Tmp: k = 1: Tmp = ""
Next i
XP下测试通过
Dim k As Integer
Dim Str As String
Dim Tmp As String
Dim By() As String
Str = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21"
By = Split(Str, ",")
k = 1
For i = 0 To UBound(By) - 1
If Tmp = "" Then Tmp = By(i) Else Tmp = Tmp & "," & By(i) '这里我用,做分隔,你也可以改别的
k = k + 1
If k = 20 Or i = UBound(By) - 1 Then List1.AddItem Tmp: k = 1: Tmp = ""
Next i
XP下测试通过
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询