Click here to Skip to main content
15,905,420 members
Home / Discussions / C#
   

C#

 
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 
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 
Use of System.Threading.Timer requires a lot of thought because the callbacks always occur on the thread pool. This means they almost always fire on a different thread to the one that created the timer, that they can run concurrently if the callback function takes a long time to execute, and conversely can be blocked indefinitely if the thread pool is busy.

It is generally much safer to use a System.Windows.Forms.Timer, as long as you're running a message loop (Application.Run) on the thread. This causes the callback to be fired on the thread that created the timer when no other message is outstanding after the timer duration has passed. (This class maps directly to the operating system's SetTimer call.)

When you're debugging, you're typically stepping through code much more slowly than once a second, so the timer could well be firing another callback while you're still debugging it. You need to ensure that this isn't what you're seeing.

I can't see a problem with using GetProcesses, except to note that there's also a GetProcessesByName method which could simplify your code a bit. (Internally, this method calls GetProcesses, though, and copies the matches to an ArrayList and then to another array, so it actually produces more garbage.)


DoEvents: Generating unexpected recursion since 1991

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 
AnswerRe: Two properties in combobox pick list Pin
JoeSharp28-May-08 2:35
JoeSharp28-May-08 2:35 
GeneralRe: Two properties in combobox pick list Pin
AndrusM28-May-08 23:31
AndrusM28-May-08 23:31 

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.