Can anyone give me some examples with threads with win forms. I have one form which make post request to a server. When i start form and hit "start" button my form read one .txt file. I want to make when start .. read 50 rows then stop and waiting for another click on "start" . Then read next 50 rows.

5 Years
Discussion Span
Last Post by JasonWung

but, i dont think you wil need a thread for this, in Start_Click event write your logic, in that have a loop which can read 50 rows, disable the start button until 50 rows are read, then enable it, again for the next click, read the next 50 rows.


It makes sense to load data from the file in a seperate thread, but is by no means required for this specific situation. The time it takes to load 50 lines of text is probably so small that it won't affect the user in any way, so you can probably get away with blocking the UI thread while loading it. As soon as you start loading thousands of lines you will want to start looking into multithreading.


Yes, I read soem tutorials and i find that for my case will be ok with loop. I will try this way.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.