Click here to Skip to main content
15,902,112 members
Home / Discussions / C#
   

C#

 
GeneralRe: Can we declare method with optional parameters ? Pin
Mohammad Dayyan1-Jun-08 22:26
Mohammad Dayyan1-Jun-08 22:26 
QuestionHow to prevent to changing row in DataGridView when user is edit Mode ? Pin
hdv2121-Jun-08 7:46
hdv2121-Jun-08 7:46 
Questionftp treeview Pin
jammmie9991-Jun-08 1:27
professionaljammmie9991-Jun-08 1:27 
AnswerRe: ftp treeview Pin
Christian Graus1-Jun-08 4:00
protectorChristian Graus1-Jun-08 4:00 
QuestionCheck Box in grid view Pin
venkat86_ece31-May-08 23:54
venkat86_ece31-May-08 23:54 
AnswerRe: Check Box in grid view Pin
Christian Graus1-Jun-08 4:01
protectorChristian Graus1-Jun-08 4:01 
AnswerCP Ignore Pin
leckey1-Jun-08 10:14
leckey1-Jun-08 10:14 
QuestionWindows service status checking Pin
George_George31-May-08 22:09
George_George31-May-08 22:09 
Hello everyone,


I am using the following code segment to check the status of a specific Windows service. My question is, if the service name does not exists, when we tries to get the Status property of the Windows service, there is InvalidOperationException. What is the elegant way to solve this issue (I have not found an API to check whether a service exists, and if I can check whether a service exists, I can check the Status property only for the service which exists)?

    ServiceController controller = new ServiceController("not existing service");
    try
    {
        if (controller.Status == ServiceControllerStatus.Running)
        {
            // do something
        }
    }
    catch (InvalidOperationException ex)
    {
        // come here when service name does not exist
    }
}



thanks in advance,
George
AnswerRe: Windows service status checking Pin
Zoltan Balazs31-May-08 23:03
Zoltan Balazs31-May-08 23:03 
GeneralRe: Windows service status checking Pin
George_George31-May-08 23:23
George_George31-May-08 23:23 
Questionconsole mode and service mode Pin
George_George31-May-08 21:43
George_George31-May-08 21:43 
AnswerRe: console mode and service mode Pin
PIEBALDconsult1-Jun-08 5:14
mvePIEBALDconsult1-Jun-08 5:14 
GeneralRe: console mode and service mode Pin
George_George1-Jun-08 14:36
George_George1-Jun-08 14:36 
QuestionMouseEventArgs and Screen Position Pin
Expert Coming31-May-08 19:39
Expert Coming31-May-08 19:39 
AnswerRe: Better Way Pin
Expert Coming31-May-08 20:17
Expert Coming31-May-08 20:17 
AnswerRe: MouseEventArgs and Screen Position Pin
Shree31-May-08 23:13
Shree31-May-08 23:13 
QuestionVSTO Excel Help Pin
sharp_k31-May-08 15:38
sharp_k31-May-08 15:38 
AnswerRe: VSTO Excel Help Pin
jammmie9991-Jun-08 1:41
professionaljammmie9991-Jun-08 1:41 
GeneralRe: VSTO Excel Help Pin
sharp_k1-Jun-08 7:24
sharp_k1-Jun-08 7:24 
Question2 BinaryWriter for a file ? Pin
Xmen Real 31-May-08 15:23
professional Xmen Real 31-May-08 15:23 
AnswerRe: 2 BinaryWriter for a file ? Pin
Anthony Mushrow31-May-08 15:45
professionalAnthony Mushrow31-May-08 15:45 
GeneralRe: 2 BinaryWriter for a file ? Pin
Xmen Real 31-May-08 15:48
professional Xmen Real 31-May-08 15:48 
QuestionfolderBrowserDialog and Saving file Pin
MumbleB31-May-08 10:57
MumbleB31-May-08 10:57 
AnswerRe: folderBrowserDialog and Saving file Pin
That Asian Guy31-May-08 11:11
That Asian Guy31-May-08 11:11 
GeneralRe: folderBrowserDialog and Saving file Pin
MumbleB31-May-08 21:00
MumbleB31-May-08 21:00 

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.