Complete task THEN continue

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Complete task THEN continue

 
0
  #1
Jan 9th, 2009
I need need it to update my ListView before continueing

  1. if (chars.Length > 0)
  2. {
  3. string log = string.Format("{0}:{1}", acc.Username, acc.Password);
  4. UpdateListView();
  5. sWorking += log + "\r\n";
  6.  
  7. foreach (IJJIAccount.GunZCharacter gc in chars)
  8. {
  9. log = string.Format("\t{0} - Level {1}", gc.CharName, gc.Level);
  10. sWorking += log + "\r\n";
  11. }
  12. }

UpdateListView()

  1. void UpdateListView()
  2. {
  3. ListViewItem Lvi = new ListViewItem(acc.Username);
  4. ListViewItem.ListViewSubItem LviPassword = new ListViewItem.ListViewSubItem(Lvi, acc.Password);
  5. Lvi.SubItems.Add(LviPassword);
  6. IDC_ListView.Items.Add(Lvi);
  7. }

Atm it updates it once the thread has finished its business but i need the check to either run on another thread or the update to finish before it continues
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 136
Reputation: cVz is an unknown quantity at this point 
Solved Threads: 7
cVz's Avatar
cVz cVz is offline Offline
Junior Poster

Re: Complete task THEN continue

 
0
  #2
Jan 9th, 2009
Yo dude, maybe something like this will work , it works for me ...

  1.  
  2. Application.DoEvents();
  3. listView1.Refresh();
Last edited by cVz; Jan 9th, 2009 at 2:14 am.
Delphi & C# programmer deluxe...
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: Complete task THEN continue

 
0
  #3
Jan 9th, 2009
nope its fine, i just ran it in another thread
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: Complete task THEN continue

 
0
  #4
Jan 9th, 2009
If you just want to update, calling application.DoEvents can have bad reactions and cause odd things, so, you can just run .Update() which causes a repaint but doesnt cause new bits of code to run
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC