In C# I know this
if (textBox1.Text.Length > x)
{
textBox1.AppendText(Environment.NewLine);
}
(x is some random number)
But what if I want to break on first space before x?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think your question is:
So given this example:
And “X” is 30, then I would expect a new line to be inserted between “jumped” and “over”.
I think this is something that would work for you:
Where
formattedcontains the new string with the line-break. Note thatLast()will give an exception if there are no spaces in the string at all. In that case, useLastOrDefaultand handle appropriately.So given your example: