Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parse C# designer.cs and modify?
Message
From
31/08/2009 11:42:49
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01420050
Message ID:
01421899
Views:
32
>>>>>>>Hmm. My experience is otherwise. If you make any change to a form using the designer the generated code is *complelely* rewritten so any change you have made manually is lost.
>>>>>>
>>>>>>Well, I guess you've only ever changed the *wrong* stuff! <g>
>>>>>
>>>>>Conversely, I don't think I've ever changed the *right* stuff. Can you give a simple example of where changing anything in the form designer will retain other values in the *.Designer.cs file?
>>>>>Regards,
>>>>>Viv
>>>>
>>>>PMJI, I parsed the designer.cs file and replaced the boundproperty on over 100 controls. After that, I opened it up in the designer (all my changes were there) and started modifying the controls' appearance and adding code behind where necessary. I've added code behind and saved and rebuilt the project probably 20 times since and there hasn't been a problem yet. We use source control (Team Foundation Server) and can always go back to a previous changeset if necessary, but so far it hasn't been.
>>>>
>>>>I don't know which ones are safe to modify and which are not. I did it all programmatically, not manually. I only know by trying it and then opening it up in the designer and modifying something and then rebuilding and testing it.
>>>
>>>I have done the same thing but always make sure I don't have the design surface open with changes pending in it. I suspect it might have more to do with the order of things than anything else. If you are editing in the design surface and have not saved and then go make changes in the designer.cs file they may get overwritten when you save the design surface changes. I don't know this, but maybe an explanation.
>>>Tim
>>
>>When I did this programmatically, I made sure that the form was not open in VS. In fact, I have the solution closed. Also, I did not change the sequence of lines in the designer.cs, only the values inside the quotes in some lines. I don't add lines programmatically either. So you may be correct as to why it worked for me.
>
>Speaking of resenquencing lines, I saw something in MSDN Magazine over the weekend about a free utility called NArrange. It does text beautifying such as grouping methods into regions, putting them in alphabetical order, and so forth. It integrates into VS as an add-on that can be run from the Tools menu. Sounds intriguing.
>
>UPDATE: More info towards the end of this column ---
>
>http://msdn.microsoft.com/en-us/magazine/ee294454.aspx

Does it allow for customizing the regions to match design patterns?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform