how to copy all data from richtexbox to listbox
The idea is I have this richtetxbox that I populate with some data and format
I want every item in the rich textbox on a button_click event to be transfered from richtetxbox to listbox .Any guidance is welcome.
thanks
Tranfering data from richtetxbox to a listbox c#
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Feb 23, 2015, 5:56 AM EST
private void button1_Click(object sender, EventArgs e)
{
if (richTextBox1.Text.Length > 0)
{
listBox1.Items.AddRange(richTextBox1.Lines);
}
}
It's also assumed that, if there are existing items in the ListBox, these will be added to, not overwritten.
Ekona Pikin38 reputationPosted Feb 23, 2015, 7:04 AM EST