I’m trying to display content of the selected row into text box. This code doesn’t work because it only add first selected item.
EDIT: This kind of work but my display look like this: ListViewSubItem: {a} ListViewSubItem: {b}
if (!string.IsNullOrEmpty(PC.SubItems[1].Text) && !string.IsNullOrEmpty(PC.SubItems[2].Text))
{
txtPc.Text = e.Item.SubItems[1].ToString()
+ " " + e.Item.SubItems[2].ToString();
}
EDIT: This works well:
private void SelectedItem(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (tabSelectPage.SelectedTab != tabPage2)
txtSelected.Text = "User: " + e.Item.SubItems[1].Text +
"Pass" + e.Item.SubItems[2].Text;
else
txtSelected.Text = "URL: " + e.Item.SubItems[1].Text +
"User: " + e.Item.SubItems[2].Text +
"Pass" + e.Item.SubItems[3].Text;
}
This is how I have done it: