您可以使用字符串比较 http://msdn.microsoft.com/en-us/library/zkcaxw5y%28v=vs.80%29.aspx方法 :String.Compare (String strA, String strB, Boolean ignoreCase)
Pass ignoreCase
与争论true
将执行不区分大小写的比较。
If String.Compare(TextBox2.Text, "a", true) = 0 AndAlso String.Compare(TextBox21.Text, "a", true) = 0 Then
'MessageBox.Show("A")
totCorrect = totCorrect + corAns
ElseIf String.Compare(TextBox2.Text, "b", true) = 0 AndAlso String.Compare(TextBox21.Text, "b", true) = 0 Then
'MessageBox.Show("B")
totCorrect = totCorrect + corAns
ElseIf String.Compare(TextBox2.Text, "c", true) = 0 AndAlso String.Compare(TextBox21.Text, "c", true) = 0 Then
'MessageBox.Show("C")
totCorrect = totCorrect + corAns
ElseIf String.Compare(TextBox2.Text, "d", true) = 0 AndAlso String.Compare(TextBox21.Text, "d", true) = 0 Then
'MessageBox.Show("D")
totCorrect = totCorrect + corAns
Else
totWrong = totWrong + wrgAns
Label13.Visible = True
End If
另一个想法是使用大写或小写输入ToUpper http://msdn.microsoft.com/en-us/library/ewdd6aed.aspx or ToLower http://msdn.microsoft.com/en-us/library/e78f86at.aspx.
If TextBox2.Text.ToUpper() = "A" AndAlso TextBox21.Text.ToUpper() = "A" Then
'MessageBox.Show("A")
totCorrect = totCorrect + corAns
ElseIf TextBox2.Text.ToUpper() = "B" AndAlso TextBox21.Text.ToUpper() = "B" Then
'MessageBox.Show("B")
totCorrect = totCorrect + corAns
ElseIf TextBox2.Text.ToUpper() = "C" AndAlso TextBox21.Text.ToUpper() = "C" Then
'MessageBox.Show("C")
totCorrect = totCorrect + corAns
ElseIf TextBox2.Text.ToUpper() = "D" AndAlso TextBox21.Text.ToUpper() = "D" Then
'MessageBox.Show("D")
totCorrect = totCorrect + corAns
Else
totWrong = totWrong + wrgAns
Label13.Visible = True
End If