Hi all,
I am programmatically populating TextBox controls where in some instances I am populating a TextBox control with more text than can be visually displayed by the TextBox control, so what I want is to display the right-side of the text string.
So for example, if I have the following string, and the TextBox control is only long enough to see a portion of this string, I want it to display want I have put in bold. Is this possible
I put this string in a TextBox control
Thanks in advance.
Tryst

Getting the right-side of a text string to display in a TextBox
Coot
check this thread: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=347535&SiteID=1
it's been answered there.
chrouble
Tryst
Petter Skodvin
Of course, the other answer only works if the form is big enough to hold the entire string. You'd think that setting the TextAlign property to Right would do this, but it doesn't work that way.
One trick is to assign the SelectionStart to the end of the string. This alters where the control thinks the cursor is located, and makes the end of the text visible.
myTextBox.SelectionStart = myTextBox.TextLength;
Hope that helps,
Erik
Wurschti
Hi Tryst,
Thanks for your feedback and congratulations on your excellent job!
Regards,
Cleo
Mapper
Hi Tryst,
Here are two methods of TextBox control for your reference.
this.textBox1.SelectionStart = this.textBox1.TextLength - 1;
this.textBox1.ScrollToCaret();
I sincerely hope it does make sense to your problem. We very much value your comments and look forward to further feedback from you. Please feel free to ask if you have any questions.
Cleo