Glenn Patton

Glenn Patton

  • NA
  • 308
  • 82.8k

Copying a rich Text Box to a list Box.....

May 22 2012 10:55 AM
Hi All,

Yet another question, I have a large amount of data in a Rich Text Box that I am trying to copy to a List Box. Using the ListBox.Items.Add() method will pick up the text and copy it lock stock & barrel to the list box ignoring any carridge return/ line feeds in the rich text box. what I am pretty sure I need is a foreach loop to go into the richTextBox.
and each time there is a \n add the item to the listBox but I am unsure of how to format this foreach loop. I have tried : 
int a = 0;

string[] Readings = Value.Split('\n'); 
 foreach (string v in Readings)
{
     a++;
    listBox1.Items.Add(a);
}
                                

Answers (5)