472,799 Members | 1,763 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 software developers and data experts.

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 InitializeComponent 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 1832
"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 InitializeComponent to
set any or all of these properties when I save the form?
\\\
< _
DesignerSerializationVisibility( _
DesignerSerializationVisibility.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 InitializeComponent 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
BrowsableAttribute 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.PreFilterProperties and ControlDesigner PostFilterProperties
methods. Furthermore, if you use reflection or indeed the PropertyGrid at
runtime you can create custom filters by having your class implement the
ICustomTypeDescriptor 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 InitializeComponent 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
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
2
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...
2
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...
3
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...
7
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...
27
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...
2
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...
1
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...
6
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? ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.