Vb.net VB If语句和/或

Vb.net VB If语句和/或,vb.net,Vb.net,如果用户输入A或。。输出是苹果。这也适用于字母B和C,所以。。。我应该在哪里/如何放置和/或操作员 Private Sub txtchange_Change() If txtchange.Text = "A" Then lbloutput.Caption = "Apple" ElseIf txtchange.Text = "B" Then lbloutput.Caption = "Banana" ElseIf txtchange.Text = "C" Then lb

如果用户输入A或。。输出是苹果。这也适用于字母B和C,所以。。。我应该在哪里/如何放置和/或操作员

Private Sub txtchange_Change()

If txtchange.Text = "A" Then
    lbloutput.Caption = "Apple"

ElseIf txtchange.Text = "B" Then
    lbloutput.Caption = "Banana"

ElseIf txtchange.Text = "C" Then
    lbloutput.Caption = "Cat"

ElseIf txtchange.Text = "D" Then
    lbloutput.Caption = "Dog"

Else
    lbloutput.Caption = "Not Found"

End If


End Sub

简单来说。。用例选择

Private Sub txtchange_Change()

Select case Ucase(txtchange.Text)
case "A" : lbloutput.Caption = "Apple"
case "B" : lbloutput.Caption = "Banana"
case "C" : lbloutput.Caption = "Cat"
case "D" : lbloutput.Caption = "Dog"
case "RED" : lbloutput.BackColor = RGB(255, 0, 0)
case Else
  lbloutput.Caption = "Not Found"
End Select

End Sub

如果txtchange.Text=A或txtchange.Text=A,则 lbloutput.Caption=Apple

您可以拥有: 如果txtchange.Text=A或txtchange.Text=A,则
lbloutput.Caption=Apple

我想你没必要这么做。你为什么这么认为?我们不知道你想要实现什么,这使得你很难知道你应该在哪里使用和/或。如果你问我如何改进这段代码,我会告诉你,但事实上,我同意其他人的说法,这个问题很不清楚。请解释你想做什么,因为没有人能读懂你的想法,并确定你为什么认为你需要在这个例子中插入和/或逻辑。谢谢:我还没有遇到选择案例。也许这就是原因。但是谢谢你。@KC Chan。。这与选择案例无关。。它在Ucase函数中。。如果ucasetxtchange.Text=A,只需更改您的。。如果ucasetxtchange.Text=B。。等等..@KC Chan。。是的。。和塔克斯!