Create controls on runtime

2 posts, 0 answers
  1. Silvana
    Silvana avatar
    1 posts
    Member since:
    Jan 2009

    Posted 20 Jan 2009 Link to this post

    Hi all,

    I was wondering if it's possible to create controls on runtime. I want the users to be able to design their own forms, placing whatever control they want on them.
    I'm able to add some Telerik controls to a toolbox but then when I try to drag and drop them I got the following error:
    "Failed to create component..."

    I guess this is because the machine where I'm testing my app doesn't have Telerik installed and it needs the License.
    Is there any kind of license which allows me to distribute my app and get rid of the necessity of having the users to install Telerik?

    Thanks in advance

    Regards

    Silvana
  2. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 23 Jan 2009 Link to this post

    Hello Silvana,

    Thank you for writing.

    Yes, RadControls can be created and added to your form in run-time  in the same way as standard controls:
    private void Form1_Load(object sender, EventArgs e)  
    {  
        RadTextBox tb = new RadTextBox();  
        tb.Location = new Point(25, 25);  
        tb.Text = "My text";  
        this.Controls.Add(tb);  

    What you are trying to accomplish (allowing your users to design their own forms) is very interesting and at the same time can be very difficult to implement.
    Also there are some things that are not clear:
    1. if your users will be designing forms in run-time how is the Visual Studio Toolbox involved?
    2. what will be the result of a user designing a form, i.e. how that form will be persisted so that it can be loaded when it must be shown?

    You can distribute your application made with RadControls by distributing Telerik's dlls on the client machine. You can find the following KB Article useful if you are using Click Once distribution.

    Do not hesitate to contact me again if you have other questions.

    All the best,
    Martin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top