Can I create textbox control programatically?

  • Thread starter Thread starter Sunny
  • Start date Start date
S

Sunny

Based on value entered on one text box, I want to create multible text box
and resize the form. Is it possible?
 
Based on value entered on one text box, I want to create multible text box
and resize the form. Is it possible?

You can't "create" controls at runtime in VBA like you can in VB, but you can
hide/show controls. Try to determine how many controls you are likely to need at
any one time and place them on the form. Set their "Visible" property to False.
Now you can set their "Visible" property based on your textbox value. If your
forms won't be maximized, you can use the "MoveSize" method to resize your form
as needed (just keep in mind that there might be screen resolution issues that
you'll need to deal with in this case).
 
Thanks Bruce.
Bruce M. Thompson said:
You can't "create" controls at runtime in VBA like you can in VB, but you can
hide/show controls. Try to determine how many controls you are likely to need at
any one time and place them on the form. Set their "Visible" property to False.
Now you can set their "Visible" property based on your textbox value. If your
forms won't be maximized, you can use the "MoveSize" method to resize your form
as needed (just keep in mind that there might be screen resolution issues that
you'll need to deal with in this case).
 
Back
Top