Results 1 to 3 of 3

Thread: Dynimically changing the size and location of controls

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Location
    India
    Posts
    134

    Dynimically changing the size and location of controls

    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.
    Pavan Kumar

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Dynimically changing the size and location of controls

    textBox1.Location = new point (100,100);
    textBox1.Size = new Size (10,100);

    textBox2.Size = textBox1.Size;

    etc etc
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Dynimically changing the size and location of controls

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width