Thursday, May 5, 2011

Add item in separated rows in listview

When i add a listview to my form and in form load event i write below code , items added in the same row not in separated rows , how can i add them to separated rows

            listView1.MultiSelect = true;
            listView1.CheckBoxes = true;
            listView1.Items.Add("Item 1");
            listView1.Items.Add("Item 22");
            listView1.Items.Add("Item 333");
From stackoverflow
  • Taking a stab at this, I'd suggest that it's because your ListView is defaulting to small icons or tiles. Try adding this line anywhere there:

    listView1.View = View.Details;
    
  • Are you sure ?
    Normally, with this code, you should have added 3 items, and you should see 3 rows when the View property of the ListView is set to Details

  • try this out

    listView1.View = View.List;
    

0 comments:

Post a Comment