Click to See Complete Forum and Search --> : Create Buttons and Forms at runtime!
Frank100
December 19th, 2009, 09:59 AM
I have to create buttons,forms at runtime after reading XML file.
XML file will contain numbers of buttons and froms which i have to create run time.
Please let me know right way.
mariocatch
December 19th, 2009, 05:02 PM
Why don't ya try and attempt it first.
Create a program to read an xml file and retrieve the number of buttons you want to create.
At runtime, create a new System.Windows.Form. Add a button to the Form, and Show() the Form.
Arjay
December 20th, 2009, 09:57 AM
Check out xaml - it's what it does.
ClayC
December 20th, 2009, 01:05 PM
well just to give this dude some stuff he wants,
Declare a button, label, textbox w/e, set it's properties and then add to the form.
so here is a button example
Button myButton = new Button();
myButton.Name = "btnMyButton";
myButton.Text = "My Button";
myButton.Size = new System.Drawing.Size(100, 20);
myButton.Location = new System.Drawing.Point(this.Width - 150, this.Height - 125);
this.Controls.Add(myButton);
myButton.Show();
myButton.BringToFront();
Hope this is a good enough example that sets you on your way to create w/e you need ;)
ClayC
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.