hi
i'm using this code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace Shutdown
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Process.Start("Shutdown", "/s");
}
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("shutdown", "/a");
}
}
}
------------------------------
but not happend ,what's problem?
thanx.

Abhay ShankerPosted Jul 15, 2014, 1:23 AM
http://www.codeproject.com/Tips/480049/Shut-Down-Restart-Log-off-or-Lock-your-computer-in
Abhay ShankerPosted Jul 15, 2014, 1:13 AM
http://www.c-sharpcorner.com/uploadfile/dhananjaycoder/shut-down-restart-log-off-and-forced-log-off-system-using-C-Sharp/
hope can be helpful to you
payam hayatiPosted Jul 14, 2014, 8:30 AM
when clik button just open new form!
Problem image:
http://ahvazsell.ir/Problem/shutdown.png
Abhay ShankerPosted Jul 13, 2014, 11:10 PM
First, add this using namespace statements:
using System.Diagnostics;
using System.Runtime.InteropServices;
To shut down your computer, use this code:
Process.Start("shutdown","/s /t 0");
To restart your computer use this code:
Process.Start("shutdown", "/r /t 0");