473,626 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Make Property dynamicaly change between ReadOnly and ReadWrite

I'm writing a winforms app in vb.net 1.1 and want to know if there's a way
to dynamically change a property in a business class from readwrite to
readonly and back again. The next thing I want to do is set the databound
control in the UI to be readonly or disabled when the property its bound to
is readonly. This is because when certain conditions are present such as a
value in a another field, I want to make this field readonly. I can think
of a number of ways to do this such as raising events in the business class
or simply processing the logic in the UI, but I was trying to think of a way
that would involve the UI as little as possible and have the business class
be responsible for most of the work.

any recommendations ?

Thanks.

--
mo*******@nospa m.nospam
Nov 21 '05 #1
1 1446
There isn't a way to make a property truly read-only at run-time. The most
you could do is set a flag and use applicatoin logic to prevent the property
from being set.

"moondaddy" wrote:
I'm writing a winforms app in vb.net 1.1 and want to know if there's a way
to dynamically change a property in a business class from readwrite to
readonly and back again. The next thing I want to do is set the databound
control in the UI to be readonly or disabled when the property its bound to
is readonly. This is because when certain conditions are present such as a
value in a another field, I want to make this field readonly. I can think
of a number of ways to do this such as raising events in the business class
or simply processing the logic in the UI, but I was trying to think of a way
that would involve the UI as little as possible and have the business class
be responsible for most of the work.

any recommendations ?

Thanks.

--
mo*******@nospa m.nospam

Nov 21 '05 #2

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

Similar topics

9
1835
by: Sasha | last post by:
Hi, I am extending standard IEnumerator, and I was just wondering what is the best way to make enumarator safe? What do I mean by safe? Detect deletes and all... My idea is to have private Guid state field in the collection, and every time something is inserted or deleted from the collection, I will just change the guid. Enumerator will just have to compare the guid received in the begging to the current one. If they are different, the...
8
19205
by: Davíð Þórisson | last post by:
Emm, being a newbie to C#, can someone explain to me what is the difference between a constant (as a Class member) and a read only property?? Also I simply cannot grasp the concept of static methods, can someone please explain it to me in human language??
15
2506
by: Mark Goldin | last post by:
I have main aspx page with a number of user controls. How can I create a global property that will be visible in every user control? Thanks
10
7239
by: GP | last post by:
Is it possible to iterate through all the controls collection and make the textboxes alone as read only.I don't see a readonly property for the Control.Can some one help me in this context? I want to do something like this below.But I get a message Readonly is not valid property. foreach (Control ctl in pnlBenefits.Controls) { if (ctl is TextBox) ctl.ReadOnly=false; }
0
5560
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...
7
1685
by: Raymond Lewallen | last post by:
Want to know if/how to get a list of properties that are available in a class and store the properties names in an arraylist. TIA, Raymond Lewallen
2
1336
by: Don | last post by:
If you expose an object as a property in a VB.NET class, like so: public class MyClass private obj as NestedClass Public Readonly Property NestedObj as OtherClass Get return obj End Get End Property
1
1124
by: shapper | last post by:
Hello, I created a user control (.ascx) with a property as follows: Private _Messages As Generic.List(Of String) Public Property Messages() As Generic.List(Of String) Get Return _Messages End Get Set(ByVal value As Generic.List(Of String))
1
18957
by: dilipkp | last post by:
hi all, actually i want to make a textbox readonly... dynamically i want to change the textbox readonly and editable.. so is there any way i can specify in the style, this readonly property, and can change the style dynamically. actually i need to specify like .textboxstyle { readonly: true;
0
8203
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
8711
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
8642
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...
0
8512
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
7203
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
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1515
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.