Pictures on listview

0
0

 

Missing something?

Dim j As New ListViewItem
j.Name = 1
j.Text = 1
j.ImageSource = “/icon.png”

j.SubItems.Add(“some text”)

 

First my code works.

 

Now with the last update my code doesn’t work.

I can see the item, but not the image

You change something in the update.

 

Thanks

 

  • You must to post comments
0
0

I tried this code:

private void Window1_Load(object sender, EventArgs e)
{
var j = new ListViewItem();
j.Name = “1”;
j.Text = “1”;
j.ImageSource = “/icon.png”;
j.SubItems.Add(“some text”);

this.listView1.Items.Add(j);

j = new ListViewItem();
j.Name = “1”;
j.Text = “1”;
j.ImageSource = “/icon.png”;
j.SubItems.Add(“some text”);

this.listView2.Items.Add(j);

j = new ListViewItem();
j.Name = “1”;
j.Text = “1”;
j.ImageSource = “/icon.png”;
j.SubItems.Add(“some text”);

this.listView3.Items.Add(j);

j = new ListViewItem();
j.Name = “1”;
j.Text = “1”;
j.ImageSource = “/icon.png”;
j.SubItems.Add(“some text”);

this.listView4.Items.Add(j);
}

 

 

It works well. Can you please verify that /icon.png is present in the root of the project? Also do you see a broken image or the item doesn’t show at all? Can you provide a small test case?

 

 

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.