473,799 Members | 3,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do I make a property only modifiable by code and not design time?

Hi,

How do I make a property only modifiable by code and not design time. I
have a property that should only be modifieable by code and not design time,
What attribute should I use?
I tried [DesignTimeVisib le(false)] but this gives me an compile error:
"Attribute 'DesignTimeVisi ble' is not valid on this declaration type. It is
valid on 'class, interface' declarations only."

Help is appreciated

Lucas

Nov 15 '05 #1
4 3932
[Browsable( false )] ??

Maybe?

4Space

"Lucas Sain" <ls***@lidersof t.com> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

How do I make a property only modifiable by code and not design time. I
have a property that should only be modifieable by code and not design time, What attribute should I use?
I tried [DesignTimeVisib le(false)] but this gives me an compile error:
"Attribute 'DesignTimeVisi ble' is not valid on this declaration type. It is valid on 'class, interface' declarations only."

Help is appreciated

Lucas

Nov 15 '05 #2
Lucas,

You will want to apply the Browsable attribute to your property, with a
value of false, to indicate that designers shouldn't modify it, like so:

[Browsable(false )]
public string MyProperty
{
get
{
}
set
{
}
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Lucas Sain" <ls***@lidersof t.com> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

How do I make a property only modifiable by code and not design time. I
have a property that should only be modifieable by code and not design time, What attribute should I use?
I tried [DesignTimeVisib le(false)] but this gives me an compile error:
"Attribute 'DesignTimeVisi ble' is not valid on this declaration type. It is valid on 'class, interface' declarations only."

Help is appreciated

Lucas

Nov 15 '05 #3
Thanks,

That did the job.
Do you know how to make a code in an event not execute in design time. I
have a Baseform that has X code in the event "VisibleChanged ". All my forms
inherit from this form. The code in this event always gets executed in
design time, how do I avoid this??

Regards
Lucas

Reagrds
Lucas
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:eQ******** ******@TK2MSFTN GP11.phx.gbl...
Lucas,

You will want to apply the Browsable attribute to your property, with a value of false, to indicate that designers shouldn't modify it, like so:

[Browsable(false )]
public string MyProperty
{
get
{
}
set
{
}
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Lucas Sain" <ls***@lidersof t.com> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

How do I make a property only modifiable by code and not design time. I have a property that should only be modifieable by code and not design

time,
What attribute should I use?
I tried [DesignTimeVisib le(false)] but this gives me an compile error:
"Attribute 'DesignTimeVisi ble' is not valid on this declaration type. It

is
valid on 'class, interface' declarations only."

Help is appreciated

Lucas


Nov 15 '05 #4
Thanks,

That did the job.
Do you know how to make a code in an event not execute in design time. I
have a Baseform that has X code in the event "VisibleChanged ". All my forms
inherit from this form. The code in this event always gets executed in
design time, how do I avoid this??

Regards
Lucas

"4Space" <4S****@NoSpam. com> wrote in message
news:lz******** **************@ news.easynews.c om...
[Browsable( false )] ??

Maybe?

4Space

"Lucas Sain" <ls***@lidersof t.com> wrote in message
news:eN******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

How do I make a property only modifiable by code and not design time. I have a property that should only be modifieable by code and not design

time,
What attribute should I use?
I tried [DesignTimeVisib le(false)] but this gives me an compile error:
"Attribute 'DesignTimeVisi ble' is not valid on this declaration type. It

is
valid on 'class, interface' declarations only."

Help is appreciated

Lucas


Nov 15 '05 #5

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

Similar topics

112
10370
by: Andy | last post by:
Hi All! We are doing new development for SQL Server 2000 and also moving from SQL 7.0 to SQL Server 2000. What are cons and pros for using IDENTITY property as PK in SQL SERVER 2000? Please, share your experience in using IDENTITY as PK .
0
1532
by: Ivan D. | last post by:
I am making a User Control in visual basic, it contains a Picture Box. To allow the image to change at design time I added a property. When changing a *normal* PictureBox Image at design time in the properties window the delete key usually sets the Image to nothing, but when I tried this with my new property it did not work. I have a feeling something needs to be added to the property statement in order to accept Nothing for any
0
1688
by: Jason | last post by:
What interface do I need to implement in order to get a component with a public property to show up in the data binding drop down boxes at design time in VS.net? I've tried to look just about every where I can think and I can not find the solution. The closest I can come is to implement IBindingList or IListSource to expose a list for the DataSource property on controls. This works great for controls like a list box but doesn't work...
0
1200
by: scpedicini | last post by:
Okay, I've been having a problem with custom design-time properties that has been driving me nuts for about a week. The control that I'm working on extends System.Windows.Forms.AxHost, but I'm unable to add any custom properties to the control. Eg, private string stringProp = null;
7
3020
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
5569
by: Brian Young | last post by:
Hi all. I'm using the Property Grid control in a control to manage a windows service we have developed here. The windows service runs a set of other jobs that need to be managed. The control is used to view the state of the running jobs and schedule new jobs. The control also runs in the context of Internet Explorer (we do this so the administrators of the jobs can always receive the latest control). The property grid is used to...
8
3430
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False Me.Height = 16
3
2122
by: u473 | last post by:
How do I call a reusable report with a modifiable Rowsource property and or code ? Like in the following case where the table name will change any following day ? I am using Access 2003. Private Sub Top25_Click() Dim strSQL As String strTblName = "tblNew_" & Format(Date, "ddmmmyyyy") strSQL = "SELECT TOP 25 tblOld.Fname, tblOld.Lname INTO " &
10
1512
by: Rob | last post by:
I am reading a book that says that the "name" property can be altered only at design time and cannot be modified at runtime. Please explain this given the code below... If you click Button3... fred will appear as the Name of Button1, however, the handler for Button1 works still works as well... Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
0
9546
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
10491
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
10268
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
10247
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
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
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...
0
6809
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();...
0
5593
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2941
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.