Here, I provided you a video just to be clear
Codes down here
First, you must use the System.Diagnostics to make this program run.
This is the code for the button:
if (textBox1.Text != "")
{
errorProvider1.Clear();
newprocess.StartInfo.UseShellExecute = false;
newprocess.StartInfo.CreateNoWindow = true;
newprocess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
newprocess.StartInfo.FileName = "attrib";
newprocess.StartInfo.Arguments = "-a -r -s -h " + textBox1.Text + ":* /s /d";
try
{
using (Process exeProcess = Process.Start(newprocess.StartInfo))
{
exeProcess.WaitForExit();
done.Show();
textBox1.Text = "";
}
}
catch
{
//Nothing
}
}
else
{
errorProvider1.SetError(textBox1,"Insert Drive Letter");
}
This is the code for keychange in textbox:
e.Handled = !(char.IsLetter(e.KeyChar) || e.KeyChar == (char)Keys.Back);
Enjoy!!
Thank you! Sir! ^_^
ReplyDeleteTalamat po!
ReplyDeleteTalamat po!
ReplyDeleteMR-H.A.K
ReplyDelete