Renaming a file
-
Hi, I have got a picturebox that displays an image in correspondance with the node selected in a treeview. What i want to do is when a node is renamed for the file that the picturebox is pointing to to also be renamed. The problem i get is the filenotfound exception from the rename. I am pretty sure tho not 100% that this is because the image file is being displayed in the picturebox at the same time that i am trying to rename the file. I have tried makign the picturebox empty as well as trying to use image.dispose() but i cannot seem to get it to work. Help would be VERY appreciated thanks Dean
-
Hi, I have got a picturebox that displays an image in correspondance with the node selected in a treeview. What i want to do is when a node is renamed for the file that the picturebox is pointing to to also be renamed. The problem i get is the filenotfound exception from the rename. I am pretty sure tho not 100% that this is because the image file is being displayed in the picturebox at the same time that i am trying to rename the file. I have tried makign the picturebox empty as well as trying to use image.dispose() but i cannot seem to get it to work. Help would be VERY appreciated thanks Dean
A PictureBox stores the image at that time and is not tied to the image. For instance, if you changed the image (added a line or something), the changes are not reflected automatically in the PictureBox. This requires change notification. More than likely, you're not giving a fully resolvable path to the file, which is either a fully-qualified path or a relative path to the current working directory (not necessarily always the directory from which your app is running). The best thing you can do is debug your code using the excellent tools in the IDE. Debugging code is half the battle.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----