Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

how to append items to existing listview

$
0
0

Hi

i have listview with headrs in place (8 columns) the first  four of them get populated at the start of programm and do not need to be changed; and the remaining  are to be populated  periodically  by 10  background threads ( equal to number of rows in listview);

void InitListCtr()
{
    listView1.Columns.Add("DB Server Name", 80, HorizontalAlignment.Left);
    listView1.Columns.Add("Locale No ", 80, HorizontalAlignment.Left);
    listView1.Columns.Add("Db No", 65, HorizontalAlignment.Left);
    listView1.Columns.Add("Locale ", 85, HorizontalAlignment.Left);
    listView1.Columns.Add("Status ", 65, HorizontalAlignment.Left);
    listView1.Columns.Add("Service  ", 65, HorizontalAlignment.Left);
    listView1.Columns.Add("Records", 65, HorizontalAlignment.Left);
    listView1.Columns.Add("Next Run  ", 95, HorizontalAlignment.Left);
}

the first four columns are added like this

  for (int i = 0; i < 10; i++)
{
                tm = new string[5];
                tm[0] = CDBProcessHandlerEx.SwitchObjects[i].dbserver;
                tm[1] = CDBProcessHandlerEx.SwitchObjects[i].localNo.ToString();
                tm[2] = CDBProcessHandlerEx.SwitchObjects[i].dbNo.ToString();
                tm[3] = CDBProcessHandlerEx.SwitchObjects[i].localeName;
            itm = new ListViewItem(tm);
                listView1.Items.Add(itm);
  }   

my question is:

assuming localNo is unique 

assuming my threads return string[] object including localNo

how can I append  the rest of columns to the existing columns?


Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>