I have a listview1
with information about students that can change repeatedly, as well for the Student Names (Column1
) and the Students task Column2
.
I have a textBox1
where you can type the name a possible student in Column1
.
That name will be transfered into a string
named searchstr
.
As soon as the command hits, an item in Column1
will be checked for it's existence (and if it equals the searchstr
).
if so, the Name of that student has an Index number which I receive via the commandline var index = listview.Items.IndexOf(Name);
Now with that Index number I try to receive the text value of that students task (the Subitem from Column2
) and set it in a string. Is this possible?
foreach (ListViewItem item in listview1.Items)
{
if (item.SubItems[0].Text == searchstr)
{
var Name = listview1.FindItemWithText(searchstr);
if (Name != null)
{
var index = listview.Items.IndexOf(Name);
}
}
}