[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Prevent user from changing text box on Windows Form

Posted on 2012-12-26
11
Medium Priority
?
263 Views
Last Modified: 2013-02-14
I have a windows form project that depending on the user i need to make certain text boxes read only.  I have tried using the following but it does not seem to have an effect and does not make it read only.

Me.Textbox1.Readonly = True

I am not sure if this is the correct approach.

Any help would be appreciated
0
Comment
Question by:Mike_Stevens
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
11 Comments
 
LVL 2

Expert Comment

by:corvetteguru
ID: 38721751
Which version? In certain versions you can me.txtbox.locked = true, but you can't do that in 2010... or 2008, IIRC.

You can always use me.txtbox.enabled = false, the downside is you can't see it as well.

But Readonly is the acceptable property, when I double checked it, the help text says "Controls whether the text in the edit control can be changed or not." Sounds pretty definitive.

Finally, you just don't update those fields when you hit save.
0
 

Author Comment

by:Mike_Stevens
ID: 38721763
Visual Studio 2010
0
 
LVL 2

Accepted Solution

by:
corvetteguru earned 2000 total points
ID: 38721795
Then my answer is the one you need... I am also using 2010!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38721846
Are you sure it's not working?

Readonly() prevents changes to the TextBox, but the user can still interact with the control.  The cursor changes and the user can select text and even copy it...
0
 

Author Comment

by:Mike_Stevens
ID: 38721849
I can selected text and change it even after i set the readonly property to true
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 38721866
Can you post more code then?...or possibly upload a sample project?
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38721901
readonly, is the correct approach.
you can also install infragistics and use ultratextbox which has differnt ways of disabling it.


If you really want to be classy, put a transparent label over the textbox. and use senttoback / sendtofront
instead of readonly
0
 
LVL 2

Expert Comment

by:corvetteguru
ID: 38722348
I have used infragistics... unless it  has improved, it is an overweight pig with some serious issues. I used it with .NET 2005... pretty, yes, reasonably functional, but the actual implementation leaves a lot to be desired. Oh, and it's REALLY expensive.
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38722352
Its been heavily improved,  now its a colossal pig,  but they update it at least twice a year,  so the bugs are gone
0
 
LVL 2

Expert Comment

by:corvetteguru
ID: 38722472
Thank God the bugs are out... it made the product seriously unwieldy. Have they improved the performance of the various grids?
0
 
LVL 2

Expert Comment

by:corvetteguru
ID: 38745825
Any status update on this issue?
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question