SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a rich text box in share point 2010 visual web part...i want to get only first 2 lines of the rich text box..any suggestions? i tried getting the line by using cRichtextbox.Lines but it throws an error saying

microsoft.sharepoint.webcontrols.inputformtextbox does not contain defination for lines

share|improve this question
up vote 3 down vote accepted

You should use Text property of the InputFormTextBox control, and parse the first two lines manually. It's quite easy actually, something like this:

var firstTwoLines = String.Join("\n", MyRichTextBox.Text.Split('\n').Take(2).ToArray());
share|improve this answer
Excellent! this is what i was looking for – spStacker Jan 31 '12 at 22:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.