Hi .. I'm a student that I helped by you when I was learning c for unix..
I want to ask you about different thing this time and I know you can help me
be cause I like your style helping people..
I want to ask about .net c# ...
I did a simple program that make me control my windows system using c# like turning it off or lock it at certain time the user input.. it's like scheduler but a lot easier to use my problem is "sorry for the messy desktop"
that my program will inter in a while loop until the system time = the input time.. and that cause a not responding and that is not efficient.. I tried to add "sleep" but that didn't work with it and still not responding on the while loop
any solutions to make it run normally.. this is a function of the code.."the others are same but a little different"
private void button1_Click(object sender, EventArgs e)
{
string clock;
clock = textBox1.Text;
System.Windows.Forms.MessageBox.Show("system will close in " + clock);
if (radioButton1.Checked)
{
clock = clock + " AM";
}
if (radioButton2.Checked)
{
clock = clock + " PM";
}
while (DateTime.Now.ToString("h:mm tt") != clock) // here is the problem
{
if (DateTime.Now.ToString("h:mm tt") == clock)
break;
}
System.Diagnostics.Process.Start("shutdown", "/s /t 0");
this.Close();
}