开发者

C# and .NET: TextBox.Text is not always actual?

As always, i'm forced to use technologies i'm not familiar with :(. For now it is .NET framework with by C#. It is a simple GUI application with some text fields and the almighty TextBox with the 'Text' property.

It seems that the content of this 'Text' property is not always actual O_O. For example, if i change text and click a button, accessing 'Text' property from button click event handler returns the correct, updated text. BUT开发者_StackOverflow if i change text and click an item in the menu bar, the text returned from 'Text' property is... the old one, not changed!

There are no special data bindings or other code. It is all simple forms and visual studio-generated event handlers :(. Maybe some .NET guru can spare a bit of his wisdom and clue me in to why TextBox.Text does not always contain the actual, updated value? Isn't it ::GetWindowText() as a getter implementation?


The button click causes a focus shift from the text box whixh updates the text value, where the menu click will not cause such a focus shift, so the text has not yet been updated in the textbox.


'Text' property is always actual. If it returns a wrong value than it's something in a program logic that changes it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜