473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Get Form Designer To Ignore Properties

Hi all,

I am using Visual Studio 2005.

I have a User Control with the following property

[Browsable (false) ]
public String MyProperty
{
get { return this.my_property_var; }
set { this.my_property_var = value; }
}
When I place my User Control on a form I cannot see the property in
the Property Browser (good), but default code does get generated in
InitializeConponent

......////....
MyControl.MyProperty = "";
......////....

How can I prevent this?

I really ask as my properties in my live code are DateTime properties
and their default values get set to the day/time the form was designed
and ideally I do no want to set them to DateTime.Now in the Load
method or similar.

Thanks in advance.

Kevin
Nov 11 '08 #1
2 4523

Try this attribute:

using System.ComponentModel

[DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)]

<k.******@theiet.orgwrote in message
news:3c**********************************@x16g2000 prn.googlegroups.com...
Hi all,

I am using Visual Studio 2005.

I have a User Control with the following property

[Browsable (false) ]
public String MyProperty
{
get { return this.my_property_var; }
set { this.my_property_var = value; }
}
When I place my User Control on a form I cannot see the property in
the Property Browser (good), but default code does get generated in
InitializeConponent

.....////....
MyControl.MyProperty = "";
.....////....

How can I prevent this?

I really ask as my properties in my live code are DateTime properties
and their default values get set to the day/time the form was designed
and ideally I do no want to set them to DateTime.Now in the Load
method or similar.

Thanks in advance.

Kevin

Nov 11 '08 #2
Thank you both for your replies.

[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]

works perfectly.

Kevin
Nov 12 '08 #3

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

Similar topics

3
by: Chris | last post by:
Hi, I'm trying to append text from another class to a generic richTextBox that I've added to a Windows form. I can't seem to figure out how to expose the richTextBox to append text to it. ...
12
by: Simon Jefferies | last post by:
Hello, I have created a new form within C# and I am unable to get any properties on this form and also unable to add a new controls to it. Any ideas? Simon Jefferies
4
by: A Traveler | last post by:
Hello all, I have a control i wrote which inherits from asp:label. It worked fine. It extends asp:label with a "For" property which implements the "for" attribute of an html label tag (yes i...
3
by: Wade | last post by:
I am having an issue where I have added a custom property to one of my forms, but it doesn't show up in the properties window in the designer window. The property shows up in the intellisense in...
1
by: screamingtarget | last post by:
I'm using C# 2.0. I have a UserControl-based class that contains a set of controls that are TextBox-based. The number of controls defaults to 1, but it is a browsable property (NumFields) in the...
25
by: Dave | last post by:
Hello. In trying to get an anchor element to stylistically match an input or button element, I find that the button and input cannot be styled according to the 2.1 CSS spec. For example, I...
8
by: Ryan | last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip, data binding elements (dataset, binding source, table adapter), tab control with 7 tab pages, each page contains a...
4
by: EmilH | last post by:
Hi. I couldn't find it in msdn. I have a form AddCategory. Now I need EditCategory form which should look exactlay like AddCategory. I add an inherited form to the project. Now all controls'...
2
by: ZBINContact | last post by:
Is there a directive or a command to outline code that I want the Designer to ignore? I am creating a group of user controls with extended self-checking functionality. In each user control, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.