0
我想從文本框中捕獲一個字符串,並根據在該字符串中找到的每個字符運行條件。下面的代碼是我在想什麼,但它dosnt工作?遍歷文本字符
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim s As String = TextBox1.Text
For Each c As Char In s
If c = "A" Then
MsgBox("Letter is A")
ElseIf c = "B" Then
MsgBox("Letter is A")
ElseIf c = "C" Then
MsgBox("Letter is C")
End If
Next
end sub
它以什麼方式不起作用? – har07
如果你可以在'TextBox1'被聚焦時擊中'A,B或C'鍵,然後按下'Button1',這將起作用。 –
Doh!你的權利它的工作Stuipid離開msgbox字母B表明一個我的錯誤.... – Argon