Click here to Skip to main content
15,909,373 members
Home / Discussions / C#
   

C#

 
GeneralRe: Connecting to a c# Local Database Pin
Paul Conrad4-Oct-08 15:34
professionalPaul Conrad4-Oct-08 15:34 
AnswerRe: Connecting to a c# Local Database Pin
funklet4-Oct-08 8:49
funklet4-Oct-08 8:49 
AnswerRe: Connecting to a c# Local Database Pin
jzonthemtn5-Oct-08 3:42
jzonthemtn5-Oct-08 3:42 
QuestionFail to set port using SetMulticastGroup() of IMulticastConfig to "MPEG-2 Multicast Receiver" filter Pin
Andy Rama4-Oct-08 1:18
Andy Rama4-Oct-08 1:18 
QuestionCreating a Pause Button....... Pin
Member 46731983-Oct-08 21:07
Member 46731983-Oct-08 21:07 
AnswerRe: Creating a Pause Button....... Pin
Jaime Olivares4-Oct-08 2:14
Jaime Olivares4-Oct-08 2:14 
GeneralRe: Creating a Pause Button....... Pin
Member 46731984-Oct-08 3:24
Member 46731984-Oct-08 3:24 
AnswerRe: Creating a Pause Button....... Pin
dybs4-Oct-08 12:09
dybs4-Oct-08 12:09 
Assuming your processing is all in the same class, set a class-level flag indicating the pause occurred. Also assuming your processing is being done in a loop, you might try the following:

private: bool pause;

void PauseButton_Click(Object sender, EventArgs e){
  pause = true;
}

void ContinueButton_Click(Object sender, EventArgs e){
  pause = false;
}

void ProcessFunction(){
  while(someCondition){
    if(pause){
      continue;
    }
    // Processing code goes here.
  }
}


or

void ProcessFunction(){
  while(someCondition){
    while(pause){
      Thread.Sleep(0);
      Application.DoEvent();
    }
    // Processing code goes here.
  }
}


I know some developers are against using Application.DoEvents() unless absolutely necessary, so you may perfer the first method. If you're trying to use the same button for pause and continue, then you just need the one event handler and just toggle your flag:
pause = !pause;


Brandon
QuestionHow to access stored procedure Pin
fancyfree833-Oct-08 20:39
fancyfree833-Oct-08 20:39 
AnswerRe: How to access stored procedure Pin
Wendelius3-Oct-08 21:33
mentorWendelius3-Oct-08 21:33 
AnswerRe: How to access stored procedure Pin
TALHAKOSEN4-Oct-08 3:40
TALHAKOSEN4-Oct-08 3:40 
AnswerRe: How to access stored procedure Pin
Nouman Bhatti4-Oct-08 10:08
Nouman Bhatti4-Oct-08 10:08 
AnswerRe: How to access stored procedure Pin
Jaffer Mumtaz4-Oct-08 20:17
Jaffer Mumtaz4-Oct-08 20:17 
AnswerRe: How to access stored procedure Pin
Ashwin. Shetty4-Oct-08 20:48
Ashwin. Shetty4-Oct-08 20:48 
QuestionNot working : Wmv file to Flv file using C# Pin
elango.sham3-Oct-08 20:24
elango.sham3-Oct-08 20:24 
QuestionHow to get mouse pointer of object after using Graphics.ScaleTransform()? Pin
cocoonwls3-Oct-08 18:08
cocoonwls3-Oct-08 18:08 
AnswerRe: How to get mouse pointer of object after using Graphics.ScaleTransform()? Pin
cocoonwls15-Oct-08 0:10
cocoonwls15-Oct-08 0:10 
QuestionWebBrowser Control and Images Pin
#realJSOP3-Oct-08 17:18
professional#realJSOP3-Oct-08 17:18 
AnswerRe: WebBrowser Control and Images Pin
Jaime Olivares3-Oct-08 19:21
Jaime Olivares3-Oct-08 19:21 
GeneralRe: WebBrowser Control and Images [modified] Pin
#realJSOP3-Oct-08 22:48
professional#realJSOP3-Oct-08 22:48 
GeneralRe: WebBrowser Control and Images Pin
Jaime Olivares4-Oct-08 2:16
Jaime Olivares4-Oct-08 2:16 
GeneralRe: WebBrowser Control and Images Pin
#realJSOP4-Oct-08 2:35
professional#realJSOP4-Oct-08 2:35 
GeneralRe: WebBrowser Control and Images Pin
Jaime Olivares4-Oct-08 2:50
Jaime Olivares4-Oct-08 2:50 
GeneralRe: WebBrowser Control and Images Pin
#realJSOP4-Oct-08 3:13
professional#realJSOP4-Oct-08 3:13 
GeneralRe: WebBrowser Control and Images Pin
Wendelius4-Oct-08 7:14
mentorWendelius4-Oct-08 7:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.