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

C# 

Can't add items in listview

Trying to add items to the listview but they just won't add no matter what I try.

This is the code currently
Code
var item = firstform.listView1.Items.Add(secondform.name.Text);
firstform.listView1.Items.Add("1");
item.SubItems.Add(secondform.name.Text);
item.SubItems.Add(secondform.map.Text);
item.SubItems.Add(secondform.players.Text);
item.SubItems.Add(secondform.ping.Text);

Am I missing anything? Thanks in advance.
[Image: OOFlLY4.png]
(Apr 8, 2015 02:45 PM)Ðr1ps Wrote:  Trying to add items to the listview but they just won't add no matter what I try.

This is the code currently
Code
var item = firstform.listView1.Items.Add(secondform.name.Text);
firstform.listView1.Items.Add("1");
item.SubItems.Add(secondform.name.Text);
item.SubItems.Add(secondform.map.Text);
item.SubItems.Add(secondform.players.Text);
item.SubItems.Add(secondform.ping.Text);

Am I missing anything? Thanks in advance.

try declaring the item and assigning its properties, then adding to the listview.

Hint:Spoiler (Click to View)
It still won't add the items, unless it's adding them and it won't show them?

EDIT: It seems I'm not calling it properly from the first form as it works if I add the code on the first form where the listview is
[Image: OOFlLY4.png]


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