Wednesday, 11 September 2013

How to force a textbox to update its text

How to force a textbox to update its text

So I've looked through maybe five to ten questions on stackoverflow about
setting text into a textbox using a range of commands. I've tried
SetWindowText, SendMessage with EM_SETSEL and EM_REPLACESEL, and a few
others that I can't think of off the top of my head. For the most part I
have been successful, except for one strange occurrence.
When I set the text of this specific text box, nothing appears, nothing
changes. At first I thought I was not setting the data correctly. However,
when I use Spy++ or Winspector to see the text of a textbox, the correct
data with my changes are in there, but not displayed on the actual
textbox. Even stranger, when I click back into the form with the textbox I
"edited", spy++ and Winspector's data changes to what the textbox is
displaying.
I spoke with a friend of mine and he mentioned it might be a race
condition. I'm trying to edit this box and the textbox is being edited by
some other thread as well.
If anyone has any suggestions I would really appreciate it.

No comments:

Post a Comment