Hi, new here as a member, but have visited frequently as a guest. I'm a C# developer from Canada. I primarily work on ASP.net and Pocket PC.
I am currently in the process of writing a new mobile app with the .NET Compact framework, but have hit a snag I'm hoping someone here will know something more about than myself.
So, I have a textbox, and whenever said textbox gains focus, I'd like to set the current cursor position to a specific place. I know this can be achieved by using either of the Select() method, and SelectionStart property. As such, I've done so using the former.
Problem is that, if the textbox is clicked in to gain focus it sets the SelectionStart to the right value when it gains focus, but after my GotFocus method has completed, it changes to the position that was clicked inside the box.
In another test, I tried running the same code from my GotFocus method from elsewhere.. on formLoad specifically, and it worked exactly as expected. So, the click on the box is definitely what is throwing it off.
Any thoughts on how I can get around my problem?