Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / IDE / January 2006

Tip: Looking for answers? Try searching our database.

VS designer - Removing property changes in a sub class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jan Weingärtner - 17 Jan 2006 12:20 GMT
Hi.

Assuming i have changed some properties of a control in a form sub class
in the form designer. Is there a simple way to get back all properties
of the base class?

regards and thanks,
Jan
Juan M. Servera - 18 Jan 2006 07:38 GMT
Hi,
   If the base class is well designed you can go property by property in
the property window and reset them using the right mouse button.
   Also, you can go to the InitializeComponents method, search the block
where the designer assigned all the values to your control and delete the
lines, save it and when you return to the form designer all the values will
be reset.
   For example, for a control named textBox1 you will find a block of code
like this:
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.SystemColors.MenuHighlight;
this.textBox1.ForeColor = System.Drawing.SystemColors.Menu;
this.textBox1.Location = new System.Drawing.Point(88, 91);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.textBox1.Size = new System.Drawing.Size(230, 102);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "My custom text";

So, you can remove all these lines (except maybe Location and Size) and the
base values will be taken instead of your custom ones.
Do it with a lot of care and do not remove any line that adds your control
to a Controls collection like: this.Controls.Add(this.textBox1);  or any
constructor code like: this.textBox1 = new System.Windows.Forms.TextBox();

Of course, save first a copy of your code to a safe place before trying
this.

> Hi.
>
[quoted text clipped - 4 lines]
> regards and thanks,
> Jan
Jan Weingärtner - 18 Jan 2006 17:16 GMT
>    If the base class is well designed you can go property by property in
> the property window and reset them using the right mouse button.
> ...

Thanks, but editing every changed property and removing lines
from InitializeComponents is exactly, what i try to avoid.

best regards,
Jan

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.