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

C#

 
GeneralRe: dynamic assigning of class properties Pin
Skynyrd22-Dec-04 3:48
Skynyrd22-Dec-04 3:48 
GeneralRe: dynamic assigning of class properties Pin
TyronX22-Dec-04 10:43
TyronX22-Dec-04 10:43 
Generalget row number after datagrid sort Pin
jagberg2322-Dec-04 2:15
jagberg2322-Dec-04 2:15 
GeneralRe: get row number after datagrid sort Pin
aplope23-Dec-04 5:44
aplope23-Dec-04 5:44 
GeneralRe: get row number after datagrid sort Pin
jagberg2324-Dec-04 20:18
jagberg2324-Dec-04 20:18 
GeneralDesigning a data decisional application based-on grids and graphics Pin
guim722-Dec-04 2:09
guim722-Dec-04 2:09 
GeneralServiceController.WaitForStatus() method query Pin
ipsoftware22-Dec-04 2:06
ipsoftware22-Dec-04 2:06 
GeneralRe: ServiceController.WaitForStatus() method query Pin
Dave Kreskowiak22-Dec-04 6:17
mveDave Kreskowiak22-Dec-04 6:17 
ipsoftware wrote:
(1) I am using svc.WaitForStatus(ServiceControllerStatus.Stopped); (no time out defined here, coz I don't know how long the service takes to stop...), I think there is a possibility that the code will be blocked forever here, right? just waiting , waiting for the "Stopped" status..How can I avoid this?

You answered your own question here. Yes, if there is no timeout, the call can be blocked forever if the service crashes or hangs in some way. The way around this is to set a timeout, say 15 seconds?, when you create the ServiceController object.


ipsoftware wrote:
(2) In terms of excepion, what kinds of exceptions may occur when controlling a service, what I can think of is "access right exception", what else?

Just look at the documentation for each method of the ServiceController class and you'll find the list of exceptions that each method can throw. This is on top of all the security related exceptions that can be thrown. For instance, the .Continue method can throw a Win32Exception and a InvalidOperationException.

ServiceController Methods[^] documentation.



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralTextBox caret jump Pin
Aviv Halperin22-Dec-04 1:18
Aviv Halperin22-Dec-04 1:18 
Generalon prepared statement in sql Pin
ting66822-Dec-04 0:11
ting66822-Dec-04 0:11 
GeneralRe: on prepared statement in sql Pin
David Salter22-Dec-04 0:24
David Salter22-Dec-04 0:24 
Generalhelp me shut dow xp white c# cod Pin
mehdidj21-Dec-04 20:56
mehdidj21-Dec-04 20:56 
GeneralRe: help me shut dow xp white c# cod Pin
J4amieC21-Dec-04 22:35
J4amieC21-Dec-04 22:35 
GeneralRe: help me shut dow xp white c# cod Pin
benjymous21-Dec-04 23:38
benjymous21-Dec-04 23:38 
GeneralRe: help me shut dow xp white c# cod Pin
Judah Gabriel Himango22-Dec-04 6:43
sponsorJudah Gabriel Himango22-Dec-04 6:43 
GeneralRe: help me shut dow xp white c# cod Pin
Matt Gerrans22-Dec-04 12:48
Matt Gerrans22-Dec-04 12:48 
GeneralI tried to set labe control property visible to true Pin
Mohammed Aijaz Mohiuddin21-Dec-04 19:23
Mohammed Aijaz Mohiuddin21-Dec-04 19:23 
GeneralRe: I tried to set labe control property visible to true Pin
Skynyrd21-Dec-04 22:32
Skynyrd21-Dec-04 22:32 
GeneralRe: I tried to set labe control property visible to true Pin
Mohammed Aijaz Mohiuddin23-Dec-04 1:08
Mohammed Aijaz Mohiuddin23-Dec-04 1:08 
GeneralRe: I tried to set labe control property visible to true Pin
Skynyrd23-Dec-04 5:36
Skynyrd23-Dec-04 5:36 
GeneralGetArray and SetArray Pin
SudeepPradhan21-Dec-04 18:30
SudeepPradhan21-Dec-04 18:30 
GeneralRe: GetArray and SetArray Pin
spif200121-Dec-04 19:56
spif200121-Dec-04 19:56 
GeneralRe: GetArray and SetArray Pin
SudeepPradhan21-Dec-04 20:24
SudeepPradhan21-Dec-04 20:24 
QuestionHow to AutoFit Text in a Windows Richtextbox control? Pin
AVaka21-Dec-04 17:51
AVaka21-Dec-04 17:51 
AnswerRe: How to AutoFit Text in a Windows Richtextbox control? Pin
AVaka22-Dec-04 23:13
AVaka22-Dec-04 23:13 

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.