Click here to Skip to main content
15,915,702 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using Resources Pin
ejohns8528-May-08 7:00
ejohns8528-May-08 7:00 
GeneralRe: Using Resources Pin
Gareth H28-May-08 7:32
Gareth H28-May-08 7:32 
Questionauto-complete textbox with memory Pin
AndrusM28-May-08 6:00
AndrusM28-May-08 6:00 
AnswerRe: auto-complete textbox with memory Pin
leppie28-May-08 6:46
leppie28-May-08 6:46 
GeneralRe: auto-complete textbox with memory Pin
AndrusM28-May-08 7:21
AndrusM28-May-08 7:21 
GeneralRe: auto-complete textbox with memory Pin
leppie28-May-08 21:27
leppie28-May-08 21:27 
QuestionConnect to database via web service Pin
HenrydeSousa28-May-08 4:45
HenrydeSousa28-May-08 4:45 
AnswerRe: Connect to database via web service Pin
Gareth H28-May-08 7:39
Gareth H28-May-08 7:39 
GeneralRe: Connect to database via web service Pin
HenrydeSousa29-May-08 4:20
HenrydeSousa29-May-08 4:20 
QuestionWhat is the Error Pin
ASysSolvers28-May-08 4:33
ASysSolvers28-May-08 4:33 
AnswerRe: What is the Error Pin
leppie28-May-08 6:39
leppie28-May-08 6:39 
GeneralRe: What is the Error Pin
Guffa28-May-08 8:31
Guffa28-May-08 8:31 
QuestionOpenFileDialog in Web... Pin
Chetan Ranpariya28-May-08 3:59
Chetan Ranpariya28-May-08 3:59 
AnswerRe: OpenFileDialog in Web... Pin
leppie28-May-08 4:01
leppie28-May-08 4:01 
AnswerRe: OpenFileDialog in Web... Pin
Mike Dimmick28-May-08 4:30
Mike Dimmick28-May-08 4:30 
QuestionTransferring data from Excel Sheet to SQL Server 2000 database Pin
Dextter28-May-08 3:47
Dextter28-May-08 3:47 
AnswerRe: Transferring data from Excel Sheet to SQL Server 2000 database Pin
Bijesh28-May-08 3:57
Bijesh28-May-08 3:57 
QuestionFunction for Converting Plural into Singular Pin
KBM7328-May-08 3:43
KBM7328-May-08 3:43 
AnswerRe: Function for Converting Plural into Singular Pin
leppie28-May-08 3:56
leppie28-May-08 3:56 
GeneralRe: Function for Converting Plural into Singular Pin
led mike28-May-08 4:29
led mike28-May-08 4:29 
AnswerRe: Function for Converting Plural into Singular Pin
Old Nic3-May-10 4:39
Old Nic3-May-10 4:39 
Questionhow to create dynamic gridview Pin
shaek28-May-08 3:42
shaek28-May-08 3:42 
AnswerRe: how to create dynamic gridview Pin
leppie28-May-08 3:58
leppie28-May-08 3:58 
QuestionTimer Change question.. Pin
ptr2void28-May-08 3:34
ptr2void28-May-08 3:34 
Hi,
I want to change a timer when I find that a particular process is running..

Here is my code:

class Program
    {
        System.Threading.Timer SendDataTimer;
        static void Main(string[] args)
        {
            Program MyObj = new Program();
            MyObj.MyMethod();    
        }

        public  void MyMethod()
        {
	        TimerCallback tcb_SendData = new TimerCallback(Callback_Method_SendData);
	        SendDataTimer = new System.Threading.Timer(tcb_SendData, 0, 0, 1000);         
            Console.Read();
        }
        void Callback_Method_SendData(System.Object state)
        {
            Console.WriteLine("Timer Executed at: " + DateTime.Now.ToString());
            foreach (Process p in Process.GetProcesses())
            {
                //Console::WriteLine(p->ProcessName->ToString());
                if(p.ProcessName == "notepad")
                {                               
                    SendDataTimer.Change(0, 3000);
                    //return;                                
                }            
            }        
        }
    }


However in this, when I open notepad, the timer continues to run very quickly and when I close it, then it changes the timer..
Why is it so?

I want that the timer should change the timings as soon as notepad opens but does execute very fast when I open notepad and why dosent the time change in the interval when notepad is opened?
Why does it take to close the notepad and then the timer changes..

I hope you get my question.
Thanks.
AnswerRe: Timer Change question.. [modified] Pin
leppie28-May-08 3:39
leppie28-May-08 3:39 

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.