我想在Visual Basic中使用for循環將字符串變量與字符串數組的元素進行比較。我將按照順序將用戶輸入的字符串變量與小寫字母的數組進行比較。我有一些邏輯上的錯誤,因爲我的「count」變量總是出於某種原因,因此它總是會說「Sorry,Try again」,除非用戶輸入Z.請幫忙!比較字符串與數組
Dim lower() As String = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
For count As Integer = 0 To 25
input = txtInput.Text
input = input.ToLower
If input.Equals(lower(count)) Then
txtResult.Text = "Correct"
Else
txtResult.Text = "Sorry, Try again"
End If
Next
非常感謝您! – user1959628