943,923 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 12135
  • VB.NET RSS
Jan 7th, 2009
0

how to change file name?

Expand Post »
I'm learning vb.net, I have to work with file and folders.
I need to know how to change file or folder name.
Could you help me?
Thanks for advanced!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
donaldunca is offline Offline
27 posts
since Sep 2006
Jan 7th, 2009
0

Re: how to change file name?

Sure no problem

VB.NET Syntax (Toggle Plain Text)
  1. Dim newName As New FileInfo("filename.gif")
  2.  
  3. newName.MoveTo("filename2.gif")

This should work. You can look at fileinfo.moveto() or file.move() for more information

here is an example

http://www.example-code.com/vbdotnet/rename-file.asp

you can google "vb.net rename file" and get more.

Does that help?
Reputation Points: 155
Solved Threads: 41
Posting Whiz in Training
rapture is offline Offline
294 posts
since Jul 2007
Jan 7th, 2009
0

Re: how to change file name?

vb 2005 and vb 2008:
Quote ...
My.Computer.FileSystem.RenameFile("c:\test\test.txt", "c:\test\NewName.txt")
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Append Node to existiing XML file Using Vb.net
Next Thread in VB.NET Forum Timeline: Timing problem? Variable does not always update





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC