OK, so set your click event on your button to look at the value of your textbox and then set the appropriate label's visible value to true. Something like this:
SELECT CASE textbox1.Value
CASE "1"
Label1.Visible = true
CASE "2"
Label2.Visible = true
etc.
Edit
Based upon your comment about having 30 labels, I would say that the only other way to do this would be to use the
Find
method of the
Controls
object to find the label that matches the one you are looking for. Basically, you would build a string combining the constant "label" plus the value of the text box. That way you would get "label1" when there was a 1 in the textbox. Next, you put that value into the Find method and put the results into a
For Each
loop. You should get only one but the benefit to this is that you don't have to do any error checking for zero - nothing will happen if you enter an invalid value. Inside the loop, you will need to cast the control as a label and then set the visible property to true. If you want all the labels to be invisible except the one and you are planning on running this multiple times, you will need to set every label to false before you set the one to true here.
Here is a StackOverflow question that has some details for you, including a link to the MSDN page for
Find
:
http://stackoverflow.com/questions/1178967/how-do-i-refer-to-a-windows-form-control-by-name-c-vb[
^]