473,698 Members | 2,630 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding properties from the Forms Designer

(VB.Net 2003)
I have a UserControl that exposes a number of public properties.

When using this control on a.n.other Form, how can(?) I prevent
the Forms Designer from adding code into InitializeCompo nent to
set any or all of these properties when I save the form?

There are one or two that I /might/ want set in this way, but I'd like
to "persuade" the Designer to leave the rest well alone ...

Any suggestions?
TIA,
Phill W.
Nov 21 '05 #1
3 1885
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> schrieb:
I have a UserControl that exposes a number of public properties.

When using this control on a.n.other Form, how can(?) I prevent
the Forms Designer from adding code into InitializeCompo nent to
set any or all of these properties when I save the form?
\\\
< _
DesignerSeriali zationVisibilit y( _
DesignerSeriali zationVisibilit y.Hidden _
) _ _

Public Property...
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #2
Hi,

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
--------------------
"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message
news:dh******** **@yarrow.open. ac.uk...
(VB.Net 2003)
I have a UserControl that exposes a number of public properties.

When using this control on a.n.other Form, how can(?) I prevent
the Forms Designer from adding code into InitializeCompo nent to
set any or all of these properties when I save the form?

There are one or two that I /might/ want set in this way, but I'd like
to "persuade" the Designer to leave the rest well alone ...

Any suggestions?
TIA,
Phill W.

Nov 21 '05 #3
There are several ways to do this. People will often refer to the
BrowsableAttrib ute and override of the relavent properties. This however is
an inefficient and incorrect way to do things.

At design time, the IDE provides for the dedicated control designer assigned
to your component to filter the properties and events so that they are not
seen by the IDE. This is accomplished using the
ControlDesigner .PreFilterPrope rties and ControlDesigner PostFilterPrope rties
methods. Furthermore, if you use reflection or indeed the PropertyGrid at
runtime you can create custom filters by having your class implement the
ICustomTypeDesc riptor interface. This enables you to return an edited or
even augmented list of properties, events and attributes seen by the
reflection API's

Of course, at runtime the properties will still be available but if the
properties are filtered at design time they will not be visible to the code
serializer. IMO it's simpler to provide a designer with a property filter
than override N number of properties and mess with their browsability.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Phill. W" <P.A.Ward@o-p-e-n-.-a-c-.-u-k> wrote in message
news:dh******** **@yarrow.open. ac.uk...
(VB.Net 2003)
I have a UserControl that exposes a number of public properties.

When using this control on a.n.other Form, how can(?) I prevent
the Forms Designer from adding code into InitializeCompo nent to
set any or all of these properties when I save the form?

There are one or two that I /might/ want set in this way, but I'd like
to "persuade" the Designer to leave the rest well alone ...

Any suggestions?
TIA,
Phill W.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
6623
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
2
3173
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
2
1025
by: Scott Kilbourn | last post by:
Hi, I am working on a control that inherits System.Windows.Forms.TextBox. Of course one of the properties of a TextBox is the Text property. I would like to replace this property with a property named DatabaseText. I do not want the Text property to show up in the properties window, and I don't want it accessible at runtime or designtime. Any ideas?
3
5009
by: Tom | last post by:
I am writing a Visual basic .Net database application. There are many forms that first let you select and look at a DB record and then when you click a "modify" button you are allowed to change data in the text boxes. Then an "update" button saves the data back to the database. What is the best way to change several properties on most of the textbox controls on the form when the "modify" button is clicked? (e.g. make them editible (and...
7
2965
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and already formatted as "Shopping" ---Bold "for" -----Regular Now I want to underline whole text by preserving old style i.e. Bold and
27
1843
by: Just Me | last post by:
I made a Usercontrol that must have AutoScroll set to true when it is used. So I set it to True in the Load event. However the property still shows in the properties window when the control is placed on a form. That's confusing. How can I make that property not show in the properties window?
2
1325
by: Juan Pedro Gonzalez | last post by:
Hi, I've develpped a reusable UserControl. The only headache it's giving me is how to hide the inherited properties such as AutoScroll, DockPadding, etc... wich could cause some visual Anoyances on my control.I've tried <System.ComponentModel.Browsable(False), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableS tate.Never), System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.
1
1421
by: =?Utf-8?B?aXd1Y29tcHV0ZXJnZWVrMDU=?= | last post by:
I have encountered a frustrating problem with the VB environment, and I am afraid I need to re-install it on my system. I would like to know whether any of you have encountered the same problem or could possibly let me know of a quicker fix. The essence of the problem is this: when I select the properties of a particular object (such as a button, label, or even a form), nothing appears in the properties window, as it should. I have...
6
621
by: James Hahn | last post by:
That looks like proper Property set code to me. What is the line of code that the designer is generating in the Sub InitializeComponent for a color that you select in the Properties Settings? "Nathan Sokalski" <njsokalski@hotmail.comwrote in message news:er%23hyAFOJHA.1896@TK2MSFTNGP02.phx.gbl...
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7739
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.