Kanthri

Kanthri

  • NA
  • 3
  • 2.7k

Interrupt a loop with toggle button

Mar 2 2011 10:40 PM
I have a tcpclient and tcpserver two different csharp programs. 

In tcpclient program I have created a toggle button. This toggle button when switched on creates a tcpclient and should continuously send data to the tcpserver. I have created  a for loop for sending data continuously. 

When toggle button is switched off data transfer should be stopped i.e. control should break out of for loop.

Can you please advise me about how can I make toggle button to initiate and interrupt the for loop?   

Answers (2)