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.