|
NarVish wrote: if (sc.Status.ToString().Equals("Stopped")) Correct way to do the check is
if (sc.Status == ServiceControllerStatus.Stopped) {
sc.Start();
}
NarVish wrote: I would like to ask for credentials before the user tries to start service. Read about Application manifest and UAC[^].
If you need administrator privilege only for starting the service, you could delay request for elevation till you need it. This can be done by starting a new process and setting ProcessStartInfo.Verb[^] to runas . This new process can execute the code to start/stop the service. You need the new process because you can't change elevation levels of the current process while it is running.
Best wishes,
Navaneeth
|
|
|
|
|
If you're going to be asking for a username and password, what's the problem?? It's two labels and two textboxes on a small form and showing it!
|
|
|
|
|
i have datagridview whose datasource is assigned to datatable and 2 buttons.
click on up button should move my row up.
and click on down button should move row down.
it gives error.
"Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound."
|
|
|
|
|
That is not an error, it is an explanation, which tells you why you cannot change the position of the rows in the grid; because they are bound 1 to 1 with rows in the data source.
|
|
|
|
|
|
hey guys !
its really a dim point for me that can we write some codes to control a robot? or write some code for a external hardware?
|
|
|
|
|
You can write code with C# to control external devices, as long as they use any one of a number of standard protocols.
|
|
|
|
|
Yes you can. But you need to know how many axes the robot has and how to move the axes. If you bought the robot from a third party then they will be giving you the interface lib to communicate with the robot. some vendors sell C++ interface some have .Net libraries.
|
|
|
|
|
hi
I I made a game called snakes and ladders. I want this game to become object-oriented and how do I write?
modified 13-Feb-13 11:59am.
|
|
|
|
|
I doubt any one here go to your link and download the files from a unknown link. It's better you to update your query with some more details about the current design of your game so that others can see it and suggest a better method for you.
|
|
|
|
|
ok
for example this function are for change picture
this function in from1 :
public void tas_pic()
{
int rand = tas.taas();
for (int i = 1; i <= 6; i++)
{
PictureBox picbox = ((PictureBox)this.Controls["pb" + i.ToString()]);
picbox.Visible = false;
}
PictureBox picboxtas = ((PictureBox)this.Controls["pb" + rand.ToString()]);
picboxtas.Visible = true;
}
-------------------------------------------------
i cant move to a class as method and use this method in form1
What should I do?
|
|
|
|
|
First, the code you wrote is perfectly suitable for procedural as well as for object oriented programming. The differences between those are one abstraction layer above that.
Second: form. You were asked to improve your question. Do so instead of posting a new message. There's an "Edit" link beneath your message that's only visible to you when your'e logged in.
Please wrap code snippets in <pre lang="c#">YourCodeHere</pre> so it is better readable.
Ciao,
luker
|
|
|
|
|
saber_ershadi wrote: I want this game to become object-oriented and how do I write? By studying some books and tutorials. Google will find many samples for you.
|
|
|
|
|
|
hi every body
How to encryp video file and decrypt ?
please help
source or . . .
|
|
|
|
|
Search for "C# Encryption" and you will find lots of help.
|
|
|
|
|
If you don't want to decrypt the video to disk, play it, then delete the decrypted version (which pretty much destroys the point of even encrypting it in the first place!), then you'll have to write a codec which you build into the graph that's going to decode and play the video and audio.
This is NOT for a beginner and you are not going to be writing it in anything but C/C++. Using managed code to write this would be a much bigger pain than it's worth.
|
|
|
|
|
Usually video encryption is handled just like encrypting any other type of binary data, one buffer at a time. For details, just look at any encryption/decryption libraries out there.
|
|
|
|
|
yes, but we need a special palyer for paly decryption video file
and video encryption is not hard than other encryption ?
|
|
|
|
|
It's just a stream of bytes, like any other file on your hard drive. What the bytes represent does not matter.
|
|
|
|
|
Usually you temporarily decrypt the file... play it on any player... then encrypt it when done and get rid of the file. You could decrypt as you go if you make a codec, I believe someone else already suggested that, but that's probably not as common as you might think it is.
|
|
|
|
|
|
I have been developing C# application that is monitoring for employee time(in & out) so i want to add fingerprint so please can some one help me about the finger print code
|
|
|
|
|
Please, don't ask questions like that!
Make your subject descriptive of your problem: "Help" is not very useful as we already know you need help - or you wouldn't be asking... Perhaps in this case "Fingerprint reading for WinForms" would be better?
Then, give us details: remember that we can't see your screen, access your HDD, or read your mind - so give us all the relevant information. In this case, the make and model of your reader would probably help, as well as what you have tried so far, and what problem you have found.
Just asking "can some one help me about the finger print code" makes it look like you have done nothing yourself and want us to do your job for you. This can annoy a lot of people and isn't likely to get you a good response. Show us you have tried, show us what help you need!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
/* LIFE RUNS ON CODE */
|
|
|
|