the most stupid question ever about TextArea


I feel embarrassed, but I don’t find this in the documentation or on the forum. Maybe I’m not using the right words for search for what I need.

How do I set the focus to one specific TextArea? When the users clicks a button the TextArea is populated with some text, and I would like the cursor to be in that TextArea immediately so he can start typing.





Kudos for asking. I much rather people ask and learn something than be too “proud”* and stay unknowing.

  • you can be proud of something you achieve. You can’t be proud of something you didn’t do anything for (like being proud to be a certain nationality or race), and you certainly can’t be proud of an inability (like not being willing to ask). That’s not pride, that’s arrogance, though I often see people mixing these two up.

Thanks. This was also the code I tried, but I see it only works from within a Button, not from within another text area.

What are you trying to do “within another text area”?

No, it does not only work from within a button.

I’m copying the content of one text area to the other one.
then I would like the user to edit that text in the other one.

TargetArea0.Text=TargetArea1.Text TargetArea0.SetFocus
Exactly the same code does work from within a button.

However it depends on what you want to do. For example you could run the code from the TextArea’s TextChanged event, though I can’t see that hoping into the other TextArea every time the text changes in this one (so on every key press) is very useful.

The problem is YOU know when you are done entering text into a TextArea. But how is the computer supposed to know? Exactly, by you pressing a button to save or whatever.

Markus, indeed. That makes sense. What a bug in my head.
I’m using GotFocus now and all is working now like I want.

thanks for your help.
It’s much appreciated.
You can’t believe how much time I lost with this.
I should have asked it sooner/


Been there myself. Sometimes you know exactly what you want and it is infuriating when the computer “doesn’t get it” :wink:

P.S. What is even worse: usually as soon as you’ve asked the question you find out the answer yourself. The simple act of having to describe and formulate the problem often gives you the path to the solution.

P.P.S. Maybe add you location to your profile? :wink: