Multithreading in listbox read and write using c# -


here using 2 list boxes . after reading data listbox1 should perform tasks assigned after add result list box2 . have created 3 threads.those threads should not fetch same data list box1, once thread fetch 1 data other threads should not fetch again .

static int i;  void add()  {    for(i=0;i < listbox1.items.length;i++)    {       string x = listbox1.items[i]. string();       checker obj = new checker(x);       string s = obj.check();       add item (s);    } }  private void button4_click(object sender, event args e) {        thread[] threads = new thread[3];     (int l = 0; l < 3; l++)    {        threads[l] = new thread(new threadstart(bul_add));    }     foreach (thread t in threads)    {        t.start();    } } 

when run code, first value listbox1 read thrice , adding 3 same item listbox2 . next values added listbox2 once.

please experts , me overcome problem ...

thanks in advance !!


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -