Kyle Hughes
Kyle Hughes

Reputation: 1389

C# List View Ordering

I'm coding in VS2008 using C#.

On my form, I have a ListView control. Now, it's purpose is for the user to add items to it. However, each new item is added AFTER the last item in the list.

Is there any way to have each new item be put as the first item in the list?

Upvotes: 0

Views: 187

Answers (2)

o.k.w
o.k.w

Reputation: 25790

Use Insert into 0 index or your own choice.

See MSDN's reference

listview1.Items.Insert(0, newListviewItem);

Upvotes: 5

Andrew Hare
Andrew Hare

Reputation: 351446

Instead of using the ListView.Add method, use the ListView.Insert method.

Upvotes: 4

Related Questions