-1
I have a List in a class, and in the main class I want to take this List and add its elements to a listbox and then display them. How do I do this? Thank you!!
-1
I have a List in a class, and in the main class I want to take this List and add its elements to a listbox and then display them. How do I do this? Thank you!!
2
You can use the property Datasource.
List<string> lista = new List<string>();
lista.Add("Nome 1");
lista.Add("Nome 2");
lista.Add("Nome 3");
listBox.DataSource = lista;
0
Here is the answer to anyone who has a similar question:
foreach (var p in obterPares.pares)
{
listBoxParesGerados.Items.Add(p);
}
The p in the foreach will scroll through each element of the list, then, using the listbox add, add p
Browser other questions tagged c# list
You are not signed in. Login or sign up in order to post.
Post what you’ve done and what’s your difficulty.
– Maniero
Hello, friend. The difficulty is that I’m a beginner in C#. I researched about lists in C#, found and learned how to use them, now I wanted to display their content and I want to do this in a listbox component, and I don’t know how. So what I’ve done so far is fill out this list. That’s all.
– Lord Voldemort