forcing listview to only one column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    #1

    forcing listview to only one column

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

    Thanks,
    Bob

  • ohmmega

    #2
    Re: forcing listview to only one column

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

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

    how about it?

    Comment

    • Bob

      #3
      Re: forcing listview to only one column

      On Aug 24, 2:41 am, ohmmega <sho...@gmx.atw rote:
      i would create a listview in detail mode with one columnheader. it's
      just a workaround, but a possibility:
      >
      columnHeader1.W idth = listView1.Width - 4;
      listView1.Items .Add( new ListViewItem( new string[]
      {"TEST1","INVIS IBLE"} ) );
      listView1.Items .Add( new ListViewItem( new string[]
      {"TEST2","INVIS IBLE"} ) );
      >
      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("Na me");
      this.listView1. Columns[0].Width = this.listView1. Width -
      4;
      this.listView1. HeaderStyle = ColumnHeaderSty le.None;

      Comment

      Working...