First i need to create a form with 1 textbox, button and a label in my page. I named the textbox as txtFolderName, button btnCheckandCreate and the label as lblMessage so now, I need to put the event in my button on click.. on the onclick eventon the button i need to put the code.
protected void btnCheckandCreate _Click(object sender, EventArgs e)
{
lblMessage.Text = "";
if (!System.IO.Directory.Exists(@"c:\" + txtFolderName.Text.ToUpper() + ""))
{
System.IO.Directory.CreateDirectory(@"c:\" + txtFolderName.Text.ToUpper() + "");
lblMessage.Text = txtFolderName.Text + " Folder successfully created.";
}
else
{
lblMessage.Text = txtFolderName.Text + " is not available";
}
}
Search
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment