Why is using WaitAll within a task causing issues?

  • (2 Pages)
  • +
  • 1
  • 2

17 Replies - 1605 Views - Last Post: 01 August 2012 - 02:48 PM Rate Topic: -----

#16 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 1896
  • View blog
  • Posts: 5,687
  • Joined: 05-May 12

Re: Why is using WaitAll within a task causing issues?

Posted 31 July 2012 - 05:47 PM

I just realized that all the samples never show an example of an empty primary string. Probably because it's not that common. e.g. People would do Place and then Time.

But let's say you really want the ListViewItem text to be empty, then you would do something like:
listView1.Items.Add(new ListViewItem(new string [] {"", "Gotham City"}));
listView1.Items.Add(new ListViewItem(new string[] { "", "Metropolis" }));


Was This Post Helpful? 1
  • +
  • -

#17 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 1896
  • View blog
  • Posts: 5,687
  • Joined: 05-May 12

Re: Why is using WaitAll within a task causing issues?

Posted 31 July 2012 - 05:57 PM

This would be a saner way to do things:
listView1.Columns.Add("Place", "Place", 100, HorizontalAlignment.Left, 0);
listView1.Columns.Add("Time", "Time", 100, HorizontalAlignment.Left, 0);
listView1.Columns[1].DisplayIndex = 0;    // display time before place
listView1.Columns[0].DisplayIndex = 1;

listView1.Items.Add(new ListViewItem("Gotham City"));
listView1.Items.Add(new ListViewItem("Metropolis"));


Was This Post Helpful? 1
  • +
  • -

#18 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 1896
  • View blog
  • Posts: 5,687
  • Joined: 05-May 12

Re: Why is using WaitAll within a task causing issues?

Posted 01 August 2012 - 02:48 PM

Since we got retcon'd and you were last asking about filling other columns, here's code posted from last night:
            listView1.View = View.Details;
            listView1.Columns.Add("Place", "Place", 100, HorizontalAlignment.Left, 0);
            listView1.Columns.Add("Time", "Time", 100, HorizontalAlignment.Left, 0);
            listView1.Columns[1].DisplayIndex = 0;
            listView1.Columns[0].DisplayIndex = 1;

            listView1.Items.Add(new ListViewItem("Gotham City"));
            listView1.Items.Add(new ListViewItem("Metropolis"));
            listView1.Items[0].SubItems.Add("Bat!");
            listView1.Items[1].SubItems.Add("Sups!");
            listView1.Items[0].SubItems[1].Text = "Batman";


Was This Post Helpful? 1
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2