I'm a beginner to the c# language.i just tried some code to save an image in to a folder.but i just wanna change the name of the image using a textbox text and save it to a folder.plese help me!! this is my code..
string appPath = Path.GetDirectoryName(Application.ExecutablePath) +
@"\IMAGES_DB\";
if (Directory.Exists(appPath) == false)
{
Directory.CreateDirectory(appPath); }
if (opFile.ShowDialog() == DialogResult.OK)
{
try
{
string iName = opFile.SafeFileName;
string filepath = opFile.FileName;
File.Copy(filepath, appPath + iName);
pictureBox2.Image = new Bitmap(opFile.OpenFile());
}
catch (Exception exp)
{
MessageBox.Show("Unable to open file " + exp.Message);
}
}
else
{
opFile.Dispose();
}