下面的代码不显示You Win!
阵列不能正确比较
你能帮我找到问题吗? 这两个数组都是字符串。
Sub checkwin()
Dim flag As Boolean = False
For i As Integer = 0 To win.Length - 1
If mess(i) = win(i) Then
flag = True
Else
flag = False
Exit For
End If
Next
If flag = True Then
lbl1.Content = "You Win!!"
Timer.Stop()
Dim name As String = txtName.Text
Dim data As String = "insert into puzzleTable([picName], [name], [moves], [time]) values ('mona','" & name & "','" & counter & "','" & x & "')"
mySql.executeSqlQuery(data)
End If
End Sub
请提供'mess'和'win'数组的内容。 –
你也可以缩短默认的代码设置标志为真,并且只检查是否不乱(i)= win(i) –
在If和step中加入一个断点。您可能会遇到字符串填充问题,即其中一个字符串具有尾随空格。 – Rikalous