forcing listview to only one column

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi,
How can I force a listview to have only one column so that it
resembles a listbox?

Thanks,
Bob
 
i would create a listview in detail mode with one columnheader. it's
just a workaround, but a possibility:

columnHeader1.Width = listView1.Width - 4;
listView1.Items.Add( new ListViewItem( new string[]
{"TEST1","INVISIBLE"} ) );
listView1.Items.Add( new ListViewItem( new string[]
{"TEST2","INVISIBLE"} ) );

how about it?
 
i would create a listview in detail mode with one columnheader. it's
just a workaround, but a possibility:

columnHeader1.Width = listView1.Width - 4;
listView1.Items.Add( new ListViewItem( new string[]
{"TEST1","INVISIBLE"} ) );
listView1.Items.Add( new ListViewItem( new string[]
{"TEST2","INVISIBLE"} ) );

how about it?

Great, thanks! To be a little clearer for future readers, this is
what I did:
this.listView1.Items.Clear();
this.listView1.View = View.Details;
this.listView1.Columns.Add("Name");
this.listView1.Columns[0].Width = this.listView1.Width -
4;
this.listView1.HeaderStyle = ColumnHeaderStyle.None;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top