I created an application in C# winforms. Sometimes disabled textboxes in my application loose their value (i.e. they become empty valued). Has anyone evre encountered that same problem and has a solution to resolve it ?

Thanks in advance for you advice,


Recommended Answers

All 3 Replies

It sounds like the instance that the value is held in is being lost as you are somewhere along the line creating new instances of that thing and the values are lost.

If you could post some code it would help a lot to identify your specific problem.


First of all thanks for your reply. I created my control in the design view so it's instantiated the first time the user control is being instantiated. Besides that, I never reinstantiate controls in code behind; I checked. For now, I tried setting the control readonly with a background color as if it was disabled in light grey. I don't know if this will solve this issue, but there goes a try. I don't understand more, it doesen't seem logic. It almost never happens, it sometimes happens randomly for apparently no reason, I can't find what causes it.

I have changed all disabled textboxes to readonly and the program works better ; specially when values in those textboxes are changed programmatically from code behind.



Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.