检查ComboBox的答案 [英] Check ComboBox's Answer
本文介绍了检查ComboBox的答案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个问题是,无论我在组合框中选择什么.标签显示正确".仅当我选择不输入"
I have a problem is, no matter what I select in the combobox. The Label display "Correct" only when I select "Do Not Enter"
这是我的代码:
Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
If PictureBox1.Image.ToString = My.Resources.Image_1.ToString Then
If ComboBox1.Text = "Do Not Enter" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_2.ToString Then
If ComboBox1.Text = "Narrow Bridge" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_3.ToString Then
If ComboBox1.Text = "No Bicycles" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_4.ToString Then
If ComboBox1.Text = "No Left Turn" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_5.ToString Then
If ComboBox1.Text = "No Pedestrians" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_6.ToString Then
If ComboBox1.Text = "No U-Turn" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_7.ToString Then
If ComboBox1.Text = "Road Narrow" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_8.ToString Then
If ComboBox1.Text = "Stop" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_9.ToString Then
If ComboBox1.Text = "Stop Sign Ahead" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
ElseIf PictureBox1.Image.ToString = My.Resources.Image_10.ToString Then
If ComboBox1.Text = "Traffic Signal Ahead" Then
Label1.Text = "Correct"
Else Label1.Text = "Incorrect"
End If
End If
End Sub
除了不输入"是不正确的"为什么?
Other than "Do Not Enter" is "Incorrect" why?
推荐答案
我有一个问题是,无论我在组合框中选择什么.标签显示正确".仅当我选择不输入"
I have a problem is, no matter what I select in the combobox. The Label display "Correct" only when I select "Do Not Enter"
[...]
[...]
您期望什么?在第一个图片中查看您的内心世界……然后……
what do you expect? See your inner if...then..else in the first picture-case:
If ComboBox1.Text = "Do Not Enter" Then
Label1.Text = "Correct"
Else
Label1.Text = "Incorrect"
End If
它将报告正确"的仅在不输入"的情况下被选中...
It will report "correct" only in the case that "Do not enter" is selected...
此致
托尔斯滕
这篇关于检查ComboBox的答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文