Read-only Property, read-only Control?

Read-only Property, read-only Control?

Old forum URL: forums.lhotka.net/forums/t/3927.aspx


dagware posted on Wednesday, November 21, 2007

Let's say I have a property in my business object that only has a "getter" and not a "setter". When I bind this property to a Windows Form control, like a TextBox, I expected the control to be read-only. Am I wrong in expecting this? It appears that I'm wrong, and I want to verify that before I go on. It's possible I'm doing something else wrong, so I want to be sure.

Thanks!

Dan

William replied on Wednesday, November 21, 2007

When you bind a read-only property to a TextBox control, you will need to explicitly set the TextBox.ReadOnly property to True; otherwise, you will receive runtime error when the TextBox control attempts to call the setter on the property.

Copyright (c) Marimer LLC