保存文件对话框错误处理 [英] Save file dialog error handling

查看:73
本文介绍了保存文件对话框错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi ..我创建了一个需要保存图像的工具..保存图像时没有问题,但是当我单击窗口对话框中的取消"按钮以选择目录时出现了问题.将会出现错误警告.任何人都可以帮助我解决问题吗? tq.这是保存文件的代码:


hi.. i create a tool that need to save image.. there is no problem when saving the image but it''s problem when i click the cancel button at window dialog to select the directory. there will be error warning appear.. can anyone help me to resolved the problem? tq. this is the code to save the file:


SaveImage.ShowDialog()
                Dim NewFileName As String = SaveImage.FileName
                My.Computer.FileSystem.WriteAllBytes(NewFileName, PicAndText, True)

推荐答案

Microsoft解决方案是ShowDialog()之后的以下代码:

Microsoft''s solution is the following piece of code after your ShowDialog():

If SaveImage.FileName <> "" Then



进行检查以确保它们是选定的文件名.这是文章的链接:

http://msdn.microsoft.com/en-us/library/sfezx97z.aspx [ ^ ]



That checks to be sure their is a file name selected. Here is a link to the article:

http://msdn.microsoft.com/en-us/library/sfezx97z.aspx[^]


这篇关于保存文件对话框错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆