索引数小于索引数组的维数 [英] Number of indices is less than the number of dimensions of the indexed array

查看:218
本文介绍了索引数小于索引数组的维数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    Dim tableautemp() As String = IO.File.ReadAllLines(nomfichier)
    Dim etudianttemp() As String

    For i As Integer = 0 To tableautemp.Length - 1
        etudianttemp() = tableautemp(i).Split(";"c)
        For j As Integer = 0 To 6
            tableau(j, i) = etudianttemp(j)
        Next
    Next

我想读取文件并将这些行放在一个1d标签中,然后将每一行拆分到另一个1d标签中,然后将所有内容添加到2d标签中。但是我得到索引数小于索引数组的维数。我不明白:s

I want to read the file and put the lines in a 1d tab, then split each line in another 1d tab then add everything to a 2d tab. But I get "Number of indices is less than the number of dimensions of the indexed array". I don't understand :s

推荐答案

您对数组的分配是错误的。这:

Your assignment of the array is wrong. This:

etudianttemp() = tableautemp(i).Split(";"c)

应为:

etudianttemp = tableautemp(i).Split(";"c)

您得到的错误是因为它看起来就像您尝试分配给数组中的项目而不是数组本身一样,然后您需要提供该项目的索引。该错误消息仅基于以下事实,即分配的左侧是错误的,而没有考虑右侧。

The error that you got is because it looks like you try to assign to an item in the array rather than the array itself, and then you would need to provide the index of the item. The error message is only based on the fact that the left side of the assignment is wrong, it doesn't take into account the right side.

这篇关于索引数小于索引数组的维数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆