Hi All
i have dynimically created label and textbox in a panel, i want to resize, and location of the controls dynimically. can any body please provide a solution for this.
Printable View
Hi All
i have dynimically created label and textbox in a panel, i want to resize, and location of the controls dynimically. can any body please provide a solution for this.
textBox1.Location = new point (100,100);
textBox1.Size = new Size (10,100);
textBox2.Size = textBox1.Size;
etc etc :)
Are you saying that you have created them in one section of code but you want to change their properties later? You need a reference to any object to edit its properties, so you either need to save references to those controls in class-level variables when you create them or get a reference through the Controls property of the form. If you want to use the second method you would need to set the Name property of the controls when you create them so that you can identify them later when you're searching for them. I'd suggest using a class-level array or collection to store references to the dynamically craeated controls. That way you can easily access them at any later stage.