C# ArrayList Display in Richtextbox
How would I write the code, so that when the user selects Apples from the comboBox the data that I have stored in my arraylist that relates to apples will show in the richtextbox?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit ChoudharyPosted Feb 27, 2010, 2:18 AM
as i understood i think you want something like this:
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedItem == "XYZ")
{
for (int i = 0; i < myData.Count; i++)
{
richTextBox1.Text += myData[i] + Environment.NewLine;
}
}
}
Don't forget to mark the answer if it helps.