c# - How to Stop VS Designer from messing up my already present code -


everytime move designer view whole designer.cs code messed : vs designer reorganizes code blocks , puts irritant verbose prefixes "this.whatever" , qualifies objects using "system.windows.forms.whatever" know "designer.cs" not intended edited need gui code customization time time , these stay changed them.

how avoid ? (guess funky vs handle)

(actually avoiding use of designer , hand, old way)

update :
i surprised see herd-like reaction towards question. sorry if disturbing, interesting see that, before hitting me on hand saying "don't that, it's bad", no 1 asked why wanted it.
imho question relevant , that's why : many of "auto-generated" code rubbish , of absolutely no use, need enhancement. 1 example (among soooo many others) : why generate size/location property when control's dock mode set fill ? wanted take advantage of benefits whithout drawdowns.
anyway, i'll keep short answer : take (with rubbish) or leave all.

it's simple: don't edit designer code. warnings there reason, , visual studio work correctly needs own file.

this partial class: need do, can in matching non-designer file class; includes control declarations , other things. since you're trying avoid designer entirely, let visual studio have file , put in normal .cs file.

update: based on comment, want add following —
either use designer or don't use designer. don't wishy-washy it. if you're using , relying on designer things, must leave designer's file alone.

if you're avoiding designer, avoid designer. everything can in own code (except of course visual queues, can done better via prototyping). can create own additional file partial class keep designer-like code in.

if you're using designer occasional code generator reduce boring typing, in separate project or on throw-away form in existing project , copy/paste code over.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -