Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

add listview items on top of the list

When I add a new item to my listview I don't wanna add it down the list but I want it on top of the list as the first item.
How can I reverse this?

My current code is:
Code
Dim item1 As New ListViewItem("item1")
        ' Place a check mark next to the item.
        item1.Checked = True
        item1.SubItems.Add(ToolStripStatusLabel4.Text)
        item1.SubItems.Add(ToolStripStatusLabel7.Text)
        item1.SubItems.Add(NumericUpDown1.Text)
        ListView1.Items.AddRange(New ListViewItem() {item1})
[Image: MbYfMNk.png]
Do you even bother to Google? I searched your thread title and appended vb.net and I got the answer on the first click.
(Jun 13, 2017 12:42 PM)+Haze Wrote:  Do you even bother to Google? I searched your thread title and appended vb.net and I got the answer on the first click.

I always google before asking but I just can't find it, I landed on SQL, .net and other stuff.
I'd like to know what you've found, you probably use different terms.
[Image: MbYfMNk.png]
(Jun 13, 2017 01:07 PM)Johan Cruyff Wrote:  I always google before asking but I just can't find it, I landed on SQL, .net and other stuff.
I'd like to know what you've found, you probably use different terms.

I Googled the same thing as Haze and as well got the result on the top result.

Indeed, the title says something about SQL, but if you were to actually check out the answers you would see the first answer gives you the answer you are looking for. You should check out most results that are even in the slightest relevant to get your answers.
Code
Dim item As New ListViewItem()
item.Checked = True
item.Text = "I am not"
item.SubItems.Add("even making an attempt")
item.SubItems.Add("to learn how to do this.")

Dim lv As New ListView
lv.Items.Insert(0, item)
Need a custom software? Check out my freelance service here! 6+ years and counting, never a complaint :)

STOP STEALING CODE.

FREE NATHAN

People who report posts are lamers.
(Jun 13, 2017 02:06 PM)idb. Wrote:  
Code
Dim item As New ListViewItem()
item.Checked = True
item.Text = "I am not"
item.SubItems.Add("even making an attempt")
item.SubItems.Add("to learn how to do this.")

Dim lv As New ListView
lv.Items.Insert(0, item)


Thanks, this works perfectly :)
[Image: MbYfMNk.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by FarosMolokoNov 2, 2018 02:28 PM 4 176 Nov 2, 2018 02:28 PM
Last Post: He B TeMy
[C] by lol3771Aug 8, 2018 10:03 AM 2 171 Aug 8, 2018 10:03 AM
Last Post: lol3771
[C#] by RhinemannJul 21, 2018 06:02 AM 5 179 Jul 21, 2018 06:02 AM
Last Post: Rhinemann