Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Guys I just wanted to ask that is it possible to change the layout of a form completly at runtime like if I have a textbox and a Button on form A. When I press the button the button and textbox should dissapear and a combo box or 3 new text box should appear on form A.

Thanks
Posted
Comments
BillWoodruff 28-Nov-14 16:05pm    
Yes ! Please start experimenting and examine Control Properties like 'Visible, and Control Methods like 'Hide() and 'Show().

You can also create new Controls at run-time.

Looking forward to your specific questions as you enjoy learning how to do this.

1 solution

Yes, you can even build an entire form from scratch at runtime.

All you have to do is change the properties of the controls you want to manipulate somehow.
 
Share this answer
 
Comments
Syed Muhammad Ali Gardezi 28-Nov-14 16:50pm    
Can you give me a link or something from which i can get an idea
Philippe Mori 28-Nov-14 20:22pm    
Really, this is not hard. You just modify the same property as you would do in design. For example, button1.Visible = false would hide the button. and you can show hidden controls by setting Visible to true. If you UI is not complicated, then it is easier to simply hide control that are not shown initially and make them visible when appropriate.
BillWoodruff 28-Nov-14 20:03pm    
Should this type of brief, general, advice be posted as "solution" ?
Philippe Mori 28-Nov-14 20:19pm    
It explain enough to have either 4 or 5 points in this case at least if all controls were initially created but some were hidden.
BillWoodruff 28-Nov-14 21:12pm    
My comment was a comment on Dave's solution, not your comment, Phillipe.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900