Click here to Skip to main content
12,455,917 members (35,696 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
i have 5 textboxes and a richtextbx of 5 line. how can i get 1st line text of richtextbox in 1st textbox, 2nd line text of richtextbox in 2nd textbox, and so on
Posted 23-Feb-13 21:18pm
Comments
arvindnitin7 26-Feb-13 23:17pm
   
suppose if we left myTextBoxForLineTwo blank then it shows blank space in myRichTextBox.
how to remove this blank space from myRichTextBox.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Try:
string[] lines = myRichTextBox.Lines;
if (lines.Length >= 5)
    {
    myTextBoxForLineOne.Text = lines[0];
    myTextBoxForLineTwo.Text = lines[1];
    myTextBoxForLineThree.Text = lines[2];
    myTextBoxForLineFour.Text = lines[3];
    myTextBoxForLineFive.Text = lines[4];
    }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 24 Feb 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100