473,385 Members | 1,341 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,385 software developers and data experts.

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*******@nospam.nospam
Nov 21 '05 #1
1 1435
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*******@nospam.nospam

Nov 21 '05 #2

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

Similar topics

9
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...
8
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...
15
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
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...
0
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...
7
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
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...
1
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...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.