Building Dynamic .NET Controls with Windows Forms
page 1 of 6
Published: 07 Sep 2007
This article demonstrates how to load Controls dynamically, as well as position and align them according to their text length.
by Vishal Patil
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 25501/ 42


In many projects we encounter the situation where we need to load controls dynamically on the form, as well as position and align them properly. Generally we do this when we are not sure about the number of fields to be displayed and their text size. Imagine a situation where there are several modules and for each module a pop dialog with different field names should be displayed. Instead of creating an individual popup dialog for each module, we can create one popup dialog and based on module name, pass the field names to the pop dialog which will dynamically load, position and align controls on it. This helps take advantage of flexibility and gives us the power of adding controls at runtime.

In the below example I will demonstrate how to achieve this.

View Entire Article

User Comments

Title: good   
Name: kumar
Date: 2010-10-14 4:28:46 AM
Your concept is good, and give some realtime examples.
Title: ABCD   
Name: EFGH
Date: 2008-05-15 8:48:45 AM

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-06-24 9:21:35 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search