readonly

OneWayToSource binding from readonly property in Xaml

I'm trying to bind to a Readonly property with OneWayToSource as mode, but it seems this cannot be done in XAML: <controls:FlagThingy IsModified="{Binding FlagIsModified, ElementName=container, Mode=OneWayToSource}" /> I get: The property 'FlagT...

Is there a read-only generic dictionary available in .NET?

I'm returning a reference to a dictionary in my read only property. How do I prevent consumers from changing my data? If this were an IList I could simply return it AsReadOnly. Is there something similar I can do with a dictionary? Private _mydictionary As Dictionary(Of String, String) Public ReadOnly Property MyDictionary() As Dicti...

How to make a reference type property "readonly"

I have a class Bar with a private field containing the reference type Foo. I would like to expose Foo in a public property, but I do not want the consumers of the property to be able to alter Foo... It should however be alterable internally by Bar, i.e. I can't make the field readonly. So what I would like is: private _Foo; ...

InfoPath - This form cannot be filled out .... read-only version of this form?

Hello, In my project I am using InfoPath and I store the xml it produces in database (through a WS) - so there is no SharePoint along the way. When I open the InfoPath form the server it always shows this weird message: This form cannot be filled out, either because you do not have adequate permissions, another user has the form open,...

How do I export Readonly variables with mod_perl?

I'm trying to make it easier to follow some Perl Best Practices by creating a Constants module that exports several of the scalars used throughout the book. One in particular, $EMPTY_STRING, I can use in just about every Perl script I write. What I'd like is to automatically export these scalars so I can use them without defining them ...

ReadOnlyAttribute vs PropertyDescriptor.IsReadOnly()

What is the difference between using a PropertyDescriptor that returns a value for the IsReadOnly() method, and one that is associated with a ReadOnlyAttribute? ...

How to override List<T>.IsReadOnly in C#

I'm trying to derive from List and selectively turn the IsReadOnly property on and off. I was hoping that the Add/Remove/[] functions would honor this property, but they don't. What's the right way of doing this? My derived class has some additional properties, so I can't unfortunately just wrap the list in ReadOnlyCollection. ...

Why does a read-only textbox does not return any data in ASP.NET?

I've set a textbox to read-only. When the user clicks on it, a calendar is displayed and the user selects the date which inputs into the read-only textbox. But when I try to enter the data into the database, it shows null value. What is wrong? ...

How to return a readonly copy of a collection

I have a class that contains a collection. I want to provided a method or property that returns the contents of the collection. It's ok if calling classes can modify the individual objects but I do not want them adding or removing object from the actual collection. I have been copying all the objects to a new list, but now I'm thinking t...

Is there any run-time overhead to readonly?

For some reason, I've always assumed that readonly fields have overhead associated with them, which I thought of as the CLR keeping track of whether or not a readonly field has been initialized or not. The overhead here would be some extra memory usage to keep track of the state and a check when assigning a value. Perhaps I assumed thi...

Can I change a private readonly field in C# using reflection?

I am wondering, since a lot of things can be done using reflection, can I change a private readonly field after the constructor completed its execution? (note: just curiosity) public class Foo { private readonly int bar; public Foo(int num) { bar = num; } public int GetBar() { return bar; } } Foo foo = new Foo(123); Consol...

C# return a variable as read only from get; set;

Hi all, I swear I have seen an example of this but have been googling for a bit and can not find it. I have a class that has a reference to an object and need to have a GET; method for it. My problem is that I do not want anyone to be able to fiddle with it, i.e. I want them to get a read only version of it, (note I need to be able to...

Readonly Input field will not fire OnKeyPress in IE6

I am implementing a special behaviour for the Enter key. The problem is my ASP.net library generates a readonly field; and when users tab into this field (tabbing into it is meaningful; so I want that behaviour) and press Enter to submit the form, it won't submit because it's a readonly field. I wrote a workaround that hooks up your ord...

Problem imitating VS output window's textbox with a WPF TextBox

In Visual Studio's output window, you can position your text caret at the end of the output so that the textbox scrolls down automatically when new text is logged. And when the caret is not at the end, it won't scroll down. I would like to mimic this with a WPF TextBox. I was able to do it, but only if the TextBox is not read-only. That...

How to make read only editor in Eclipse (Eclipse Plugin Development)

Hi, I'm wondering how to make a really read only eclipse editor.. My editor extends TextEditor, so when I reimplement method isEditable to always return false. It's the easiest way, which prevents user from typing or deleting anything in the document opened in the editor. But you can still change content of the document for example b...

ASP.NET - Swap TextBoxes for Labels when Enabled=False

The setup: Web form with lots of TextBox controls. When I set any one of the TextBox control's Enabled property to False, I'd like to "swap" that TextBox out for a label at runtime. The idea here being if it's read only anyway, don't display it in a control designed for editing. I'm thinking this should be pretty simple and reusable, b...

Problem with non blocking fifo in bash

Hi! I'm running a few Team Fortress 2 servers and I want to write a little management script. Basically the TF2 servers are a fg process which provides a server console, so I can start the server, type status and get an answer from it: ***@purple:~/tf2$ ./start_server_testing Auto detecting CPU Using AMD Optimised binary. Server will ...

Strange behavior using HTML 'readonly="readonly"' vs. JavaScript 'element.readOnly = true;'

Some background So I was finishing up some enhancements in a web application that does some automatic interpolation of data. There are a handful of textboxes that the user fills out, and other textboxes in between them have values automatically calculated. The textboxes that receive automatically calculated values must be readOnly to ...

how to write in excel cells using DataReader if a particular cell is "ReadOnly" using C#

Hi, I am using DataReader to write data into excelsheet cells. I have no problem until the cell has write previleges. But in one case, only one cell is readonly and the rest cells are writable. Eg : 10 * 10 cells, only first cell is readonly. so, i shuld leave this cell and write it to rest of the cells. But with the data reader it wr...

const/readonly vs. programs like Cheat Engine

I have a program, and in that program there is some variables (username and "privilege-level") that are only changed when the user logs on. Is there a way to "secure" these varaibles from memory-editing etc while the program runs, but the program is still able to change them if the user logs on with an other username. I thought it would...