File.Create Method (String)
Creates or overwrites a file in the specified path.
using System.IO;
protected void btnCreate_Click(object sender, EventArgs e)
{
string ls_FilePath = "G:\\";
string ls_FileName = txtFilename.Text + ".txt";
try
{
File.Create(ls_FilePath + "\\" + ls_FileName);
lblmsg.Text = "File Created";
}
catch(Exception ex)
{
lblmsg.Text = ex.Message;
}
}
Creates or overwrites a file in the specified path.
Code:
Add Namespace: System.IOusing System.IO;
protected void btnCreate_Click(object sender, EventArgs e)
{
string ls_FilePath = "G:\\";
string ls_FileName = txtFilename.Text + ".txt";
try
{
File.Create(ls_FilePath + "\\" + ls_FileName);
lblmsg.Text = "File Created";
}
catch(Exception ex)
{
lblmsg.Text = ex.Message;
}
}
No comments:
Post a Comment