2

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??

4
  • 3
    Can you share the code you used? What didn't work well? Commented Jan 25, 2011 at 15:46
  • 3
    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. Commented Jan 25, 2011 at 15:53
  • 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... Commented Jan 25, 2011 at 16:02
  • 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. Commented Jan 26, 2011 at 11:39

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

well yes, I managed to persuade the customer and actually ended up having just one TextBox where the user could write text. And then 2-3 read-only textbox which displayed the text.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.