Click here to Skip to main content
15,894,362 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Timer Change question.. Pin
Mike Dimmick28-May-08 4:56
Mike Dimmick28-May-08 4:56 
QuestionFile IO Permissions Pin
Lisa Zapson28-May-08 3:18
Lisa Zapson28-May-08 3:18 
AnswerRe: File IO Permissions Pin
leppie28-May-08 3:34
leppie28-May-08 3:34 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 3:47
Lisa Zapson28-May-08 3:47 
GeneralRe: File IO Permissions Pin
leppie28-May-08 4:00
leppie28-May-08 4:00 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 4:50
Lisa Zapson28-May-08 4:50 
GeneralRe: File IO Permissions Pin
leppie28-May-08 6:37
leppie28-May-08 6:37 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 8:20
Lisa Zapson28-May-08 8:20 
GeneralRe: File IO Permissions Pin
leppie28-May-08 21:31
leppie28-May-08 21:31 
AnswerRe: File IO Permissions Pin
Gareth H28-May-08 3:42
Gareth H28-May-08 3:42 
AnswerRe: File IO Permissions Pin
martin_hughes28-May-08 5:45
martin_hughes28-May-08 5:45 
GeneralRe: File IO Permissions Pin
Lisa Zapson28-May-08 5:55
Lisa Zapson28-May-08 5:55 
QuestionDataGridViewRow Question Pin
Harvey Saayman28-May-08 2:44
Harvey Saayman28-May-08 2:44 
AnswerRe: DataGridViewRow Question Pin
paas28-May-08 4:46
paas28-May-08 4:46 
GeneralRe: DataGridViewRow Question Pin
Harvey Saayman28-May-08 20:52
Harvey Saayman28-May-08 20:52 
QuestionTwo properties in combobox pick list Pin
AndrusM28-May-08 2:12
AndrusM28-May-08 2:12 

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.