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