开发者

How to clean up file location contents

I have a method which goes to a database, get some byte arrays back and then my gui displays this by creating a new windows form object and callinging a method on that form , passing in the list of bytes to display.

The thing is the gui i am calling from is in control of where the files are written, i want the loc开发者_Python百科ation cleaned on the closing of the display form.

I could pass a file path into the contrcutor of the imagedisplay form but this to me doesnt really make sense. How else can i solve this problem?


Add to the Form's Closing event. If your using VisualStudio you can do this.Closing += (and it'll auto-populate the event for you) in your constructor or _Load() event and then do your file cleanup in the Closing method that you create to handle the closing event.


You probably shouldn't be writing the byte arrays to file to begin with if you can prevent it. From your description, it sounds like you can simply pass it the byte array in memory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜