【发布时间】:2013-07-05 12:40:51
【问题描述】:
下面的代码没有显示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'数组的内容。
-
您也可以缩短代码 - 默认情况下将标志设置为 true 并仅在不混乱时检查 (i) = win(i)
-
在 If 上设置断点并单步执行代码。您可能有字符串填充问题,即其中一个字符串有尾随空格。
标签: wpf vb.net visual-studio-2012