Saturday, July 11, 2009

5. Open an EXE on Button Click

Using System. Diagnostics
string str = @"C:\windows\system32 \notepad.exe”;
Process process = new Process();
process.StartInfo.FileName = str;
process.Start();

6. Only Number is Input in TextBox

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{if (Char.IsDigit(e.KeyChar) )
{ MessageBox.Show("Bad Input");e.Handled = true; ;}}