Sadegh
Sadegh

Reputation: 6854

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");

Upvotes: 7

Views: 28222

Answers (4)

Ozgur-K
Ozgur-K

Reputation: 11

You can try listView1.View = View.Tile; There is also a vertical sroll bar.

Upvotes: 0

Reputation:

try this out

listView1.View = View.List;

Upvotes: 25

Frederik Gheysels
Frederik Gheysels

Reputation: 56934

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

Upvotes: 1

Matt Hamilton
Matt Hamilton

Reputation: 204139

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;

Upvotes: 7

Related Questions