Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In my Project, I am using Datagridview and Context Menu .I fill a information from a Particular folder .it contains file name, file Type and Size.User wants to rename a file when user select a row in the datagridview and right click on selected row on the datagridview and context Menu view..user will change the File Name in the datagridview and automatically change in the Particular folder.How to do this? Is it possible to use filewatchersystem for this task?I If "yes" Please send a code or link.
Posted

1 solution

The FileSystemWatcher has nothing to do with handling changes from a UI. It is intended to monitor changes to a file system (hence it's name). Your application needs to drive the logic to rename the file - in other words, it needs to perform a File.Move to rename the file from one filename to the other. Now, one thing to be aware of is that this is going to depend on the user having the relevant permissions to rename the file; depending on security, this might not be allowed, so your application design will have to take this into account.

File.Move[^] documentation.
 
Share this answer
 
Comments
Oshtri Deka 6-Mar-12 7:35am    
5.
Pete O'Hanlon 6-Mar-12 8:19am    
Thanks very much. I appreciate it.
naraayanan 6-Mar-12 22:51pm    
Thanks ...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900