Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 为什么外部for循环没有完成?_Vb.net_For Loop_Nested Loops - Fatal编程技术网

Vb.net 为什么外部for循环没有完成?

Vb.net 为什么外部for循环没有完成?,vb.net,for-loop,nested-loops,Vb.net,For Loop,Nested Loops,(顺便说一下,output.getUpperBound(0)等于6) (rawString和rawAverage只是字符串数组) 因此,当我逐步完成这段代码时,内部for循环会执行完整的6个循环,但一旦内部循环完成,任务就完成了。我试图实现的是内循环执行6次,6次,外循环执行6次 For x As Integer = 0 To output.GetUpperBound(0) For f As Integer = 0 To output.GetUpperBound(0)

(顺便说一下,output.getUpperBound(0)等于6) (rawString和rawAverage只是字符串数组)

因此,当我逐步完成这段代码时,内部for循环会执行完整的6个循环,但一旦内部循环完成,任务就完成了。我试图实现的是内循环执行6次,6次,外循环执行6次

For x As Integer = 0 To output.GetUpperBound(0)
        For f As Integer = 0 To output.GetUpperBound(0)
            If rawString(x).Substring(2, 1) = rawString(x + f).Substring(2, 1) And rawString(x).Substring(0, 1) <> rawString(x + f).Substring(0, 1) Then
                If blnCheck Then
                    rawAverage(x) = rawString(x).Substring(1, 1) + rawString(x + f).Substring(1, 1)
                    blnCheck = False
                Else : rawAverage(x) = rawString(x + f).Substring(1, 1)
                End If
                'rawAverage(x) = rawString(x).Substring(1, 1) + rawString(x + f).Substring(1, 1)
                Label1.Text = Label1.Text + rawAverage(x)
                Label2.Text = Label2.Text + rawAverage(x + 1)
            End If

        Next

    Next
将x作为整数=0输出。GetUpperBound(0) 将f作为整数=0输出。GetUpperBound(0) 如果rawString(x).Substring(2,1)=rawString(x+f).Substring(2,1)和rawString(x).Substring(0,1)rawString(x+f).Substring(0,1),则 如果是布朗切克那么 rawmaverage(x)=rawString(x)。子字符串(1,1)+rawString(x+f)。子字符串(1,1) blnCheck=错误 Else:rawmaverage(x)=rawString(x+f)。子字符串(1,1) 如果结束 'rawmaverage(x)=rawString(x)。子字符串(1,1)+rawString(x+f)。子字符串(1,1) Label1.Text=Label1.Text+rawAverage(x) Label2.Text=Label2.Text+rawAverage(x+1) 如果结束 下一个 下一个
代码中没有任何内容表明外部循环不会运行6次。请启用
选项Strict
。你在用StringsWorld做算术。我可能被变量名和使用的运算符误导了:
Label1.Text=Label1.Text+rawmaverage(x)
看起来它在累积结果@JamesThorpe@Plutonix是的-我删除了我的评论,因为我刚刚意识到这也是VB,所以应该是
&
。是的,字符串正在连接。刚刚又一次通过,外环执行了一次半。此外,我删除了+1(x+1),外循环总共执行了两次,非常混乱