Hi,
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.

Or is there any other way to do this ?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.