标签中的多条消息

Multiple messages in label

我正在尝试创建它以便我的标签显示每个文本框的输出,但它目前只显示最后一个块 (txtboxCat)。

If (TxtboxS1.Text = "") Then
            LblStatusBox.Text = "Score 1 is blank"

        ElseIf IsNumeric(TxtboxS1.Text) = False Then
            LblStatusBox.Text = "Score 1 is not numeric"

        ElseIf (TxtboxS1.Text < 0 Or TxtboxS1.Text > 10) Then
            LblStatusBox.Text = "score 1 is not in the range 0-10"

        ElseIf (TxtboxS1.Text > 0 Or TxtboxS1.Text < 10) Then
            LblStatusBox.Text = "Score 1 is valid"

        End If


        If (TxtboxS2.Text = "") Then
            LblStatusBox.Text = "Score 2 is blank"

        ElseIf IsNumeric(TxtboxS2.Text) = False Then
            LblStatusBox.Text = "Score 2 is not numeric"

        ElseIf (TxtboxS2.Text < 0 Or TxtboxS2.Text > 10) Then
            LblStatusBox.Text = "score 2 is not in the range 0-10"

        ElseIf (TxtboxS2.Text > 0 Or TxtboxS2.Text < 10) Then
            LblStatusBox.Text = "Score 2 is valid"

        End If




        If (TxtboxS3.Text = "") Then
            LblStatusBox.Text = "Score 3 is blank"

        ElseIf IsNumeric(TxtboxS3.Text) = False Then
            LblStatusBox.Text = "Score 3 is not numeric"

        ElseIf (TxtboxS3.Text < 0 Or TxtboxS3.Text > 10) Then
            LblStatusBox.Text = "score 3 is not in the range 0-10"

        ElseIf (TxtboxS3.Text > 0 Or TxtboxS3.Text < 10) Then
            LblStatusBox.Text = "Score 3 is valid"


        End If



        If (TxtboxCat.Text = "") Then
            LblStatusBox.Text = "Category is blank"

        ElseIf Not TxtboxCat.Text = "A" Or TxtboxCat.Text = "B" Or TxtboxCat.Text = "C" Then
            LblStatusBox.Text = "catageory is not a valid value: A,B or C"

        ElseIf (TxtboxCat.Text = "A" Or TxtboxCat.Text = "B" Or TxtboxCat.Text = "C") Then
            LblStatusBox.Text = "Category is valid"



        End If

因为代码倾向于按照您的指示执行。它勇敢地通过您的代码并按顺序重新分配值,直到它结束。此重新分配 每次都会替换字符串 。它不知道你想把它加到最后,因为你没有告诉它。

去找一个字符串追加函数。创建一个空字符串。在你说 text = "stuff" 的任何地方,用你找到的追加函数替换它,这样你就有了 一个大字符串

最后,像以前一样将该字符串放入标签中。