问题描述
我可以使用2D数组获取字段中值的列数.但是,由于该数组位于嵌套循环内,因此我不知道如何检索存储在该数组aryRow中的值.当我在循环外重复使用它时,会弹出一条消息 向上说aryRow没有被声明.您知道一种解决方法吗?
I can use 2D array to get the column count of values in a field. However, since this array is INSIDE the nested loop, I don't know how to retrieve values stored in this array, aryRow. When I re-use it outside the loop, a message popping up say aryRow isn't declared. Do you know a way to work around it?
For n As Integer = 0 To dt.Rows.Count-1
Dim ary() As String = dt.Rows(n).Item(i).ToString.Split(";")
Dim aryRow(ary.Lenght - 1, 3) As Integer
For j As Integer = 0 To ary.Length - 1
Dim k As Integer = (Val(ary(j)))
aryRow(j, k - 1) += 1
Next
Next
将aryGetValue(,)转换为整数= aryRow(j,k) ->弹出一条错误消息.
Dim aryGetValue( , ) as integer = aryRow(j,k) -> pops up an errow message.
推荐答案
但是您的目标是什么,我看到一些有关在数据库或excel表中包含用分号分隔的字符串的项目的信息.
But what is your goal, I see something about items which contain a with semicolons splitted strings inside database or excel tables.
这篇关于如何从2D数组中获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!