Click here to Skip to main content
11,410,118 members (61,621 online)
Rate this: bad
good
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 22:18pm
Comments
arvindnitin7 at 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
0 Sergey Alexandrovich Kryukov 169
1 OriginalGriff 110
2 Maciej Los 68
3 BillWoodruff 60
4 Philippe Mori 60
0 Sergey Alexandrovich Kryukov 8,755
1 OriginalGriff 6,915
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web03 | 2.8.150414.5 | Last Updated 24 Feb 2013
Copyright © CodeProject, 1999-2015
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