Taishi said:
Notice how your code was double spaced? In the future try to paste it into
Notepad first, then cut again and drop it into your message. That will
eliminate the double spacing.
On my design form I have 2 text boxes labeled lblMystery and lblNumber.
Then I have a calculate button.
Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalc.Click
Dim intMystery As Integer
This is a variable of type Decimal that you have chosen to name lblMystery
it isn't a label control.
Dim lblMystery As Decimal
Const intNumber As Integer = 10
This isn't doing much just assigning the zero in lblMystery (a Decimal) to
intMystery (an Integer)
and it indicates that you should Set Option Strict to "On" because it didn't
generate an error
Select Case intNumber
Case 1, 3, 5, 7, 9
intMystery = intNumber
Since intNumber is a constant and equal to 10 it is a safe bet that the code
here will execute
Case 2, 4, 6, 8, 10
intMystery = intNumber + 1 * 2
Case Else
intMystery = intNumber * 2 + 1
End Select
And here you have simply assigned the Integer to the Decimal variable
lblMystery = intMystery
End Sub
End Class
Note the code in my original example. You may have dropped a label onto the
form but you aren't assigning the value of intMystery to it or the code
would read as follows: lblMystery.Text = intMystery.ToString
I'd suggest that you remove the references to the lblMystery variable, check
the name of your label and try again. And go to the project setup and
change the Option Strict (in the "build" area) to "On" it will trap and
point out silly errors for you. Let the computer help you out in these
cases.
Tom