Reputation: 3
I'm trying to create it so my label shows the output of each textbox but it currently only shows the last block (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
Upvotes: 0
Views: 45
Reputation: 1096
Because code tends to do what you've told it to do. It valiantly goes through and reassigns the value in order through your code, until it gets to the end. This reassignment replaces the string each time. It doesn't know you want to add it to the end, because you didn't tell it to.
Go find a string append function. Create an empty string. Everywhere you say text = "stuff"
, replace that with the append function you find, so that you have one big string.
At the end, put that string into your label like you were.
Upvotes: 1