I'm trying to fill a listview with the code shown bellow, but when the listview is populated, each item is shown as:

ListViewItem: {The information to display1}
ListViewItem: {The information to display2}
ListViewItem: {The information to display3}
ListViewItem: {The information to display4}

My question is, how can I display only what is inside braces?
Here is my code:

ListViewItem lvi = new ListViewItem();
lvi.Text = tang2.Name;
lvi.SubItems.Add(tang2.Name.ToString());
lsvUsedAnalysis.Items.Add(lvi);

My thanks in advanced

So you only want to display {The information to display} ? Could you please specify exactly what type of layout you want to achieve withing the listview and where is tang2 assigned?

Thank you for your response!
Well, about the layout I want to use de "Details" layout, if that's what you're asking, but I'm not being able to define that layout. I'm not finding the proper way to define it.

about tang2:

foreach (TipoAngulo tang2 in ListOfAngles)
{
    ListViewItem lvi = new ListViewItem();
    lvi.Text = tang2.Name;
    lvi.SubItems.Add(tang2.Name.ToString());
    lsvUsedAngles.Items.Add(lvi);
}

When I use "Console.WriteLine" to print the value inside "tang2.Name", I see the correct value. The problem comes in the last two lines, when the the listViewItem is added to the ListView. I believe I have the listview improperly configured.

This article has been dead for over six months. Start a new discussion instead.