+ Reply to Thread
Results 1 to 4 of 4

Thread: set controls properties all at once

  1. #1
    thejeraldo is offline VB.NET Forum Enthusiast thejeraldo is on a distinguished programming path ahead
    .NET Framework
    .NET 3.0 (VS 2005/2008)
    Join Date
    Jun 2009
    Location
    Philippines
    Age
    23
    Posts
    70
    Reputation
    19

    Default set controls properties all at once

    is there any way that i can set the property of a control all at once? like for every button, i want their backcolor to be red. something like that.

    also is it advisable to set the properties of a control in design view rather than code it? does it have any performance issues? thanks!

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute JohnH has a reputation beyond repute
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Age
    37
    Posts
    11,055
    Reputation
    1564

    Default

    Select multiple controls in Design view by regular selecting methods, Properties window will then show the common properties for all selected objects, set a property value to apply to all.

    As Visual Studio is a visual development tool you should do most of the visual design in Designer/wizards/property pages, you will figure out by experience when you need to add code to that, or when using code is more beneficial.

  3. #3
    newguy's Avatar
    newguy is offline VB.NET Forum Idol newguy puts e.f. hutton to shame newguy puts e.f. hutton to shame newguy puts e.f. hutton to shame newguy puts e.f. hutton to shame newguy puts e.f. hutton to shame newguy puts e.f. hutton to shame newguy puts e.f. hutton to shame
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Jun 2008
    Location
    Denver Co, USA
    Posts
    609
    Reputation
    217

    Default

    The other way is to build one in design mode and right click on it - copy - then - paste it. It will have all same properties as the first one - just change the text of course. And if they are runtime built use a sub routine and they will all be the same. You should find no performance problems b/t designtime and runtime.
    Close Counts for Horseshoes, Handgranades, and Nuclear Missiles!

  4. #4
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,911
    Reputation
    670

    Default

    As JohnH says, you should use the visual tools the IDE provides where you can or there's no point to having them. That said, the designer merely generates code for you, so all properties are still set in code either way. If you want to see the code generated by the designer then open the Solution Explorer, click the Show All Files button, expand your form's node and then open the Designer.vb file.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Posting Permissions

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