显示后释放图像文件
我的应用程序重复显示目录中的 TIF 文件并关闭它们。 但是当我稍后尝试重命名该文件时,VB 说该文件正在被另一个进程使用。 这是代码:
Imports System.IO
Dim imgRight As Image
Dim fileRight as String
fileRight = "C:\1_Audit\PD_SE-4423344\PD_SE-4423344_0008.tif"
imgRight = Image.FromFile(fileRight)
Me.PicBoxRight.Image = imgRight
.
.
.
Me.PicBoxRight.Image.Dispose()
Me.PicBoxRight.Image = Nothing
imgRight.Dispose()
.
.
.
oldFileName = fileRight
newFileName = "PD_SE-4423344_0006.tif"
My.Computer.FileSystem.RenameFile(oldFileName, newFileName)
我需要做什么才能释放 fileRight???
My app repeatedly displays a TIF file from a directory and closes them.
But when I try to rename the file later, VB says that it is in use by another process.
Here is the code:
Imports System.IO
Dim imgRight As Image
Dim fileRight as String
fileRight = "C:\1_Audit\PD_SE-4423344\PD_SE-4423344_0008.tif"
imgRight = Image.FromFile(fileRight)
Me.PicBoxRight.Image = imgRight
.
.
.
Me.PicBoxRight.Image.Dispose()
Me.PicBoxRight.Image = Nothing
imgRight.Dispose()
.
.
.
oldFileName = fileRight
newFileName = "PD_SE-4423344_0006.tif"
My.Computer.FileSystem.RenameFile(oldFileName, newFileName)
What do I have to do to release fileRight???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论