.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

File Rename in C#.net

Posted By: Narayanan     Posted Date: October 06, 2011    Points:5   Category :C#
Hi friends,
In my Project, I get a information from a folder to Datagridview. Information are like filename,filetype,filesize and so on..My question is How to change the filename when i press rename(Contextmenu) menu at runtime .Please urgent ..
Regards,
Lakshmi Narayanan.S

Responses
Author: Amit Mehra             
Posted Date: October 07, 2011     Points: 20   

Hi,

There is no method from which you can rename a file however you 1st copy the file and than delete the older one

File.Copy(myOldFileName, myNewFileName);

File.Delete(myOldFileName);


Hope this helps

Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: Narayanan             
Posted Date: October 07, 2011     Points: 20   

Hi ,
Thanks for your reply.you can use File.Move(). I solved my problem.
Regards,
Lakshmi Narayanan.S

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend