Avinash Phadke

Avinash Phadke

  • 1.5k
  • 104
  • 2.9k

How to implement Threading

Oct 17 2018 8:43 AM
Hi,
 
I am writing 1 small utility using VS 2015, Winform. In that I have added 1 button control and 1 multiline textbox for log to display the end user. When user clicks on button control I fetch the data from Sql DB and after that I start to process this data 1 by 1. While processing this data I just want to keep on notifying the user that which record is in process, I am just appending the text to Multiline textbox.
 
All this activity works as expected only the issue is that all the Text which I am appending to textbox will get after executing all the records. In short all the log, get displayed at end in textbox. If i put debugger in process it works as expected but at runtime it is not showing me same effect.
 
I know some where I need to implement Threading but I m not sure where and how to implement it. So we can show the log line by line as the record get processed.
 
Can anyone suggest me what is a correct way to implement it. I read so many blobs on net where they suggest to use synclock, semaphore or Mutex but I am confuse what could be the appropreate method.
 
Thanks in advance
 
Regards,
Avinash Phadke 

Answers (1)