AnsweredAssumed Answered

Changing controls at runtime

Question asked by Shekhar Tanji on Apr 26, 2017



I have a user form and I am trying to change the control values at runtime.

I have many labels, textboxes etc... I want to change the visibility or the value of them at runtime based on some condition.

i tried the following:


  Dim labelNumber As String

  labelNumber = "5"

//some condition

  ("Label" + labelNumber).Visible = False

("TextBox" + labelNumber).text = 100


So that I can start a loop and set values iteratively rather than manually typing.

Used the c# approach to set it dynamically. Didn't work.


Kindly help me out.


Thank you.