2
votes

I have a winform application with two textboxes. The textboxes are multilined and has 5 rows.

When the user enters more than 5 lines of text in the first textbox I want the text to continue in the second textbox. And if he/she deletes text from the first textbox I want the text to move back from the second to the first one...

I have tried to solve this in my code by checking how many rows the first textbox has and moved text between the two textboxes. But it doesnt work that well so I wonder if anyone got a better solution??

2
Can you share the code you used? What didn't work well?btlog
are the two textboxes directly above/below one another? Why split into two. I'd be concerned if stuff moved out of my textbox somewhere else if I was typing.DRapp
I don´t have access to the code right now... DRapp: well yes.. or they are next to each other. They best solution would be if it is possible to have a multicolumn textbox...Zeno
unclear from last answer. Above/Below OR Next To. Are they touching or separate, such as Shipping Address / Billing Address? What is the context of the data.DRapp

2 Answers

1
votes

You could accomplish this by registering for the TextChanged events on the TextBox controls. Then in the event handler, manually inspect the Text property and set focus to the appropriate control. However, what you are describing sounds like it may lead to an inconsistent user experience.

From a UX standpoint I would suggest changing the approach. First of all do you really need to split the text in the UI, or could it be split afterward in the business layer? If you do need it split in the UI, you could have a single TextBox which allows the user to enter the full text, and below it have 2 read-only textbox's which display the 2 split segments as they type (you would also use the TextChanged event logic to do this as they type).

I hope this helps.

0
votes

Have you tried checking the visible Characters in the text box? or text box character length?