I am trying to create a form in C# that will get its buttons configured from a xml file. Here is a sample of my xml file:

<?xml version="1.0" ?>
- <LauncherConfig>
- <GeneralOptions>
- <Group1>
- <Button1>
<ApplicationToLaunch>"C:\Program Files\OziExplorer\OziExp.exe"</ApplicationToLaunch>

What I would like to do is on form run, check the xml for the number of buttons to create, get their size, color etc and structure the form around those buttons. I am trying to group the buttons with a label as well.

Another difficult (for me at least) is to change the orientation of the form to be either vertical or horizontal based on the xml config.

If someone can get me started with the auto-creation of the buttons based on the xml sippet, I would greatly appreciate it. I don't have a problem creating the form manually using VS2005 designer, however the on-the fly creation is giving me headaches.

Thanks in advance for any help

Creating controls in runtime is very easy task, just use XMLReader class in System.XML namespace to read your xml file and define your button properties and then create button control with specified properties.

This article has been dead for over six months. Start a new discussion instead.