ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Textbox labels at runtime (https://www.excelbanter.com/excel-programming/414634-textbox-labels-runtime.html)

Raj[_2_]

Textbox labels at runtime
 
Hi,

I want to populate a Userform with Labels of text boxes at runtime.
Also, if possible, I want the number of text boxes to be determined
at runtime. To explain the problem I will use an analogy from Banking
for adding a new customer. The form will have a dropdown box to select
the type of customer. When the customer type is selected,the customer
type value will be looked up in an excel sheet, where for each
customer type the number of text boxes and the label values of the
text boxes would be stored in a row. On selecting a customer type in
the drop down box, the form should get populated with the specified
number of text boxes and the labels displayed. Is this possible? Any
pointers or example code would be of immense help.

Any other way of approaching the problem are also welcome.

Thanks in advance for all the help.

Regards,
Raj

joel

Textbox labels at runtime
 
Put the maximum number of textboxes you would expect and then make the one
uses as "visible = true", and the ones you don't want as "visible = false".


use code like this

For BoxCount = 1 To 100
Set mybox = UserForm1.Controls("Textbox" & BoxCount)
mybox.Visible = False
Next BoxCount

or

UserForm1.TextBox1.Visible = False


"Raj" wrote:

Hi,

I want to populate a Userform with Labels of text boxes at runtime.
Also, if possible, I want the number of text boxes to be determined
at runtime. To explain the problem I will use an analogy from Banking
for adding a new customer. The form will have a dropdown box to select
the type of customer. When the customer type is selected,the customer
type value will be looked up in an excel sheet, where for each
customer type the number of text boxes and the label values of the
text boxes would be stored in a row. On selecting a customer type in
the drop down box, the form should get populated with the specified
number of text boxes and the labels displayed. Is this possible? Any
pointers or example code would be of immense help.

Any other way of approaching the problem are also welcome.

Thanks in advance for all the help.

Regards,
Raj



All times are GMT +1. The time now is 06:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com