I am made a listbox, save button and a search button, I also made an array so when the save button is pressed, the data were placed into the array, but I want to show it in the listbox when searched,
here is my code for search
foreach (Person per in Person.listperson)
{
if (textBox6.Text == per.lastname.ToString())
{
listBox1.Items.Add(per.lastname);
}
}
thanks 🙂
You can databind ListBox with your list
and this will bind all items in your list to list box showing them 🙂
Also your search can be done by LINQ:
Hope it helps 🙂