Results 1 to 14 of 14

Thread: Default properties for forms.

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    536

    Default properties for forms.

    Is there a way to change the default property settings for the design forms?

    I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want, instead of the crap they keep it in. Touchy little things, if you ask me. They sure hate it when you mess with them.

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,618

    Re: Default properties for forms.

    Quote Originally Posted by gwboolean View Post
    Is there a way to change the default property settings for the design forms?

    I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want, instead of the crap they keep it in. Touchy little things, if you ask me. They sure hate it when you mess with them.
    Not that I know of...you could just create a project checkoff list for roll outs.
    Please remember next time...elections matter!

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,928

    Re: Default properties for forms.

    What default properties are you referring to? I can't think of any.

    Most likely, you can create your own, if you wanted to, by creating your own form that inherited from System.Windows.Forms.Form and had the property settings that you wanted. You'd then use your own form as the default rather than the one that System.Windows.Forms.Form. It would work, it just seems like it's not worth bothering with.
    My usual boring signature: Nothing

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Default properties for forms.

    Odd how so many of the rest of us don't have this issue with projects blowing up. Maybe you could provide an actual description of what you're actually talking about and then we may be able to actually help. I can't think how changing a property could blow up anything, so I have no idea what you're talking about.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    536

    Re: Default properties for forms.

    Quote Originally Posted by jmcilhinney View Post
    Odd how so many of the rest of us don't have this issue with projects blowing up. Maybe you could provide an actual description of what you're actually talking about and then we may be able to actually help. I can't think how changing a property could blow up anything, so I have no idea what you're talking about.
    I was just mentioning the blow up. It has little, if anything, to do with the problem I was discussing. It is not odd at all, and probably caused by the fact that my projects are on a SD drive in the side of my Surface pro that occasionally self ejects. It is one of the many self caused problems of someone hard headed. I do know, from causing numerous blowups, that when one messes with control/form/et. al., properties that it is very easy for xml files to get messed up. But I have also noticed that when my project drive ejects while I am in a program that interesting, and seemingly unbeneficial things occur.

    The actual problem I am having with property settings probably is, to some degree, a function of keeping the projects on the SD drive. However, I have not really attempted to study that and am not particularly interested in digging into whether that is the actual cause of the issue and/or what the mitigation is. My mitigation for that is to get my crap off that SD drive and onto the C:\ drive.

    I described the information I was interested in obtaining, although I included irrelevant information. Let me state again, clearly, that what I am interested in is the never ending redundancy of having to set the same properties every single time I set up a form. What I wanted to know is whether one can change the default property settings for controls/forms, et. al., to those settings that one prefers to consistently use. Based on the other responses, this is not something that can be easily managed.

    Odd how you have a tendency to jump to conclusions, that are incorrect, that many of the rest of us do not.

  6. #6
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,832

    Re: Default properties for forms.

    I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want
    That sure sounds like you think changing the form properties is "blowing up" your project. Not sure how you think jmc jumped to an incorrect conclusion.

    If there are a group of form properties that you want to set you could set them up in the project Settings and then call a procedure in the form New event that sets the properties.
    Last edited by wes4dbt; Dec 4th, 2021 at 02:14 PM.

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    36,928

    Re: Default properties for forms.

    Sub classing the form would do it, also. If you ALWAYS (or at least very often) set property X to value Y, then just create a new form derived from the base form and set the property in the derived form.

    I'm always fiddling with properties of new forms, but it's never the SAME properties that I fiddle with, or not in the same way. And now that I think about it, it's more common for me to fiddle with the properties of controls on the form than the form itself....except for the border style. I do always seem to be changing that one, and changing it in the same way.
    My usual boring signature: Nothing

  8. #8
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Default properties for forms.

    The properties of the Form class are what they are. The WinForms designer also has some functionality baked into it that will set certain properties of forms and some controls when they are added. If you don't want to accept the property values dictated by the Form class or the WinForms designer for the Form class, neither of which you can change, then you have to not use the Form class as your base. Instead of using the Form (Windows Forms) item template, you can use the Inherited Form (Windows Forms) item template. That allows you to select a form of your own to use as the base class instead of the standard Form class. That form of your own can include whatever modifications you want, including the property values you desire. The form class you choose can be in the current project or another referenced project or library.

    I have used this functionality in the past but not for a long time, so I'm not sure exactly what limitations it may have, if any. I just checked and the item template is still available in VS 2019 for .NET Framework projects, but not for .NET 5. In that case, you can add a Form as usual and then go into the designer code file and change the base class there.

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    107,905

    Re: Default properties for forms.

    Quote Originally Posted by gwboolean View Post
    Odd how you have a tendency to jump to conclusions, that are incorrect, that many of the rest of us do not.
    I'm interested to know more about tis tendency of mine. Can you provide links to previous examples where I've done so, because a tendency would require a pattern, not a single instance. In this particular instance, as well as in any others, we only know what you tell us. If you tell us that changing form properties blew up a project then the conclusion I will draw is that you changed some form properties and your project "blew up". I'm not sure what "blew up" would actually mean but it sounds serious, i.e. things are generally unusable after they have blown up or, at least, require significant repair. If there is no causal link between the changing properties and the project "blowing up" then why would you make a statement that clearly implies that there is and then criticise us for making that inference?
    Quote Originally Posted by gwboolean View Post
    I ended up blowing up another project because I cannot keep from trying to reset the default property settings to what I want
    You do know that the word "because" indicates that A occurred as a direct result of B, right? If you just provide a full and clear explanation of the problem in the first place, avoiding irrelevancies, then there's less chance of any confusion.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2011
    Location
    Oregon City, Oregon
    Posts
    536

    Re: Default properties for forms.

    Quote Originally Posted by wes4dbt View Post
    That sure sounds like you think changing the form properties is "blowing up" your project. Not sure how you think jmc jumped to an incorrect conclusion.

    If there are a group of form properties that you want to set you could set them up in the project Settings and then call a procedure in the form New event that sets the properties.

    Not really, although I believe that there is some truth to my statement. The fact is that when one goes in and wrestles with properties, settings, etc., one can easily screw up the xml files behind all of that. I do not see how mentioning that fact, would draw one to the conclusion that this was the cause of my frustration about being unable to reset the property/settings default values, assuming it is even possible. No, JMC jumped to an incorrect conclusion, as is his wont.

    What default properties are you referring to? I can't think of any.
    I am referring to the settings and properties that already exist behind a given form. For example I might just create a new Windows form. When that form is created a well known properties window is displayed. Now in my forms I like to have my Font as Times New Roman (I hate all non San Sarif fonts), I like the form to be fixed single border style, centered in the form and no control box. As anyone can see, when they view the properties window, all of the settings have default values. They are clearly default values, since that is what shows up in every single form I create.

    What I am wanting to know is whether these default values can be changed so that every single time I create a form I do not have to go in and change the values that I routinely use. The best that I have been able to do, to mitigate this annoying activity, is to insert all of the settings/properties as I want them in the load event for the form/object and not bother going into the properties page and resetting the properties to something a little more professional looking than the crap that Microsoft prefers to put in there.

    I apologize for my lack of clarity.

    Both Shaggy, and Wes have offered suggestions that might suffice, but I have not yet had the opportunity to properly review them and try and work through those suggestions to understand how to implement them. Nor are those suggestions the equivalent to having a means to reset the default settings provided. As it stands at the moment, what I have done is create a routine that has all of the settings I prefer, which I run from the load event, and eliminates the need to go in and change the settings. While this does get the job done, I feel that there should be some means to easily (yeah, right) alter the provided default settings.

    You do know that...
    JMC, isn't that reaching rather deep to justify a statement you made that was clearly incorrect, and that you clearly took out of context? But I do thank you for stating what I already suspected, which is that the defaults are what they are and any attempt to make them different is difficult, if even possible.
    Last edited by gwboolean; Dec 5th, 2021 at 12:31 PM.

  11. #11
    Frenzied Member PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Newport, UK
    Posts
    1,559

    Re: Default properties for forms.

    Quote Originally Posted by gwboolean View Post
    Not really, although I believe that there is some truth to my statement. The fact is that when one goes in and wrestles with properties, settings, etc., one can easily screw up the xml files behind all of that. I do not see how mentioning that fact, would draw one to the conclusion that this was the cause of my frustration about being unable to reset the property/settings default values, assuming it is even possible. No, JMC jumped to an incorrect conclusion, as is his wont.



    I am referring to the settings and properties that already exist behind a given form. For example I might just create a new Windows form. When that form is created a well known properties window is displayed. Now in my forms I like to have my Font as Times New Roman (I hate all non San Sarif fonts), I like the form to be fixed single border style, centered in the form and no control box. As anyone can see, when they view the properties window, all of the settings have default values. They are clearly default values, since that is what shows up in every single form I create.

    What I am wanting to know is whether these default values can be changed so that every single time I create a form I do not have to go in and change the values that I routinely use. The best that I have been able to do, to mitigate this annoying activity, is to insert all of the settings/properties as I want them in the load event for the form/object and not bother going into the properties page and resetting the properties to something a little more professional looking than the crap that Microsoft prefers to put in there.

    I apologize for my lack of clarity.

    Both Shaggy, and Wes have offered suggestions that might suffice, but I have not yet had the opportunity to properly review them and try and work through those suggestions to understand how to implement them. Nor are those suggestions the equivalent to having a means to reset the default settings provided. As it stands at the moment, what I have done is create a routine that has all of the settings I prefer, which I run from the load event, and eliminates the need to go in and change the settings. While this does get the job done, I feel that there should be some means to easily (yeah, right) alter the provided default settings.



    JMC, isn't that reaching rather deep to justify a statement you made that was clearly incorrect, and that you clearly took out of context? But I do thank you for stating what I already suspected, which is that the defaults are what they are and any attempt to make them different is difficult, if even possible.
    https://docs.microsoft.com/en-us/vis...s?view=vs-2022 might worth a read, it gives you a way of creating your own template items. That way you could have your own Form template in the New Item... dialog box that has already had your preferences set up.

  12. #12
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,832

    Re: Default properties for forms.

    Not really, although I believe that there is some truth to my statement. The fact is that when one goes in and wrestles with properties, settings, etc., one can easily screw up the xml files behind all of that. I do not see how mentioning that fact, would draw one to the conclusion that this was the cause of my frustration about being unable to reset the property/settings default values, assuming it is even possible. No, JMC jumped to an incorrect conclusion, as is his wont
    Well, jmc, me and I bet 99% of the people. But who cares, the point has been made and whether we agree doesn't really matter or help solve your problem, I'm ready to move on.

    btw - Just for clarity, a Form doesn't have a xml file associated with it, the forms properties settings are in the design.vb file which is standard text.
    Last edited by wes4dbt; Dec 5th, 2021 at 01:36 PM.

  13. #13
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    7,051

    Re: Default properties for forms.

    Quote Originally Posted by wes4dbt View Post
    btw - Just for clarity, a Form doesn't have a xml file associated with it, the forms properties settings are in the design.vb file which is standard text.
    WPF and UWP apps use XAML which is just XML to define UI layouts. I might be wrong but I don't think OP explicitly stated it was a WinForms application he was working on. He should probably clarify this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  14. #14
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,890

    Re: Default properties for forms.

    It sounds to me like the OP is going into the file and making changes to it outside the form designer and introducing problems. In the past the IDE would warn you not to do this, not sure if it still does or not.

Tags for this Thread

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