Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parse C# designer.cs and modify?
Message
De
31/08/2009 11:03:26
 
 
À
31/08/2009 10:30:23
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01420050
Message ID:
01421887
Vues:
38
>>>>>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.
.·*´¨)
.·`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"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform