0

I have a array containing up to 10 values. I have 10 labels (label1, label2 ... so on to 10) I wantto use the array value to get a label. How do i get "label(arrayvalue).visiable = true

Im thinking about something like this

    bokstavValue = Array.IndexOf(bokstav, TextBox1.Text)
    label(bokstavValue).Visible= True
4
  • visual studio with windows form Commented Oct 20, 2015 at 12:17
  • This is not VBA... This is VB.Net Commented Oct 20, 2015 at 12:20
  • My mistake. Changed tag Commented Oct 20, 2015 at 12:22
  • Change your title please, too. Its missleading Commented Oct 20, 2015 at 12:22

2 Answers 2

2

It would be more along the lines of Me.Controls("labelName").Visible as long as it is not embedded in a groupbox or panel or tab. That woulb be to change the actual control on the form

Sign up to request clarification or add additional context in comments.

Comments

0

Not sure if VBA, but for getting an array value, you have to give the index of the value you want, like:

aArray = Array(1,2,3,4) ''Returns a single dimension array of 4 elements, from index 0 to 3
Value = aArray (1) ''Returns 2

So, if you want to modify the visibility of a Label, calling it by its name, you can use:

aArray = Array("Label1","Label2") ''Returns a single dimension array of 2 elements, from index 0 to 1
Label(aArray(0)).Visible = True ''Turns on label "Label1"
Label(aArray(1)).Visible = True ''Turns on label "Label2"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.