Hi,
I got a strange problem with a TextBox, which is in an Xpander in an XpanderList in a custom UserControl.
(Using C#, .NET 4, Visual Studio 2010, WinForms, Windows 7.)
I am making a simple "auto-complete", by starting a Timer in my TextBox TextChanged event.
If this timer fires a tick before next TextChanged event, I interpret this as the user stopped typing,
and I go doing a search in my data. After the search, I do a lot of GUI stuff to display the result.
Now, this works fine. But afterwards, my TextBox has not focus anymore!
No cursor; I can't type there without clicking in the TextBox.
I tried TextBox.Focus() and TextBox.Select() without luck, but the funny thing is that two alt-tabs helps!
Also breaking in the debugger and continuing helps: the cursor gets into the TextBox, and I can type there.
So it could look like my application or form lost focus, but how? I did not activate any other application.
Is it something with the fact that I do all this from a Timer tick event? Does it mess up the event dispatching?
Or is Xpander and XpanderList preventing something? I have the Xpander expanded and visible throughout this scenario.
Thanks for any help with this strange issue!