We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Run time adding control

chualk
chualk asked
on
Medium Priority
203 Views
Last Modified: 2010-04-30
I want to do some thing like this.
When i click on a button once, a textbox will be created.
I click again, another textbox will be created. How many textbox appear on the form will depend on how many times i click on the  button.
The textbox is created at run time.
Sample code will be most helpful.
Thanks.
Comment
Watch Question

Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Ibk :

If i want to put the textbox in different tab pages. How am i going to assign it?
I want only one  textbox in one tab page.
I am using sstab.
10Q!
lbk

Commented:
My personal advice for you is to either put a textbox array on each tab, and then load the specific one, or to use the old fashion tab control found in common controls. But thats even more complicated.
Maybe tell me what it is you need to do.

Author

Commented:
Ibk:

I don't want to create a textbox array at each page.
Just one textbox array at form load and when i goto next page, a new textbox control will be created.
lbk

Commented:
yeah, see.. you can't do, sorry. The tab control is a control container, which only takes controls at run time. You can't transfer them from page to page.
Maybe the old fashion tab strip is better for you, especially since adding tabs at run time is very easy to do. But because that tab strip doesn't take controls itself, you'd have to create a picture box that acts as a container. That way you could use the same picture box for each tab. You would have to load/unload textboxes constantly though, as the user changes from tab to tab.
Concerning your problem, were you able to create a textbox in runtime without creating one unvisible on your screen? I am experincing the same problem and was not able to solve it as well !
lbk

Commented:
There is no way to do that, becuase VB needs the information about the control at compilation time. It's just impossible to do. (Unless you're using an OLE container, but that would be senseless)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.