本文介绍了如果文件不存在,如何保存文件....但是,如果文件确实存在,请询问用户是否要覆盖,并且仅在单击“是"时才保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
到目前为止,这是我的代码,但是当用户单击不想覆盖文件时,在第一个另存为"时会发生错误:
Here is my code so far but when the user clicks that they don't want to over write the file, an error occurs at the first Save As:
If My.Computer.FileSystem.FileExists(TextBox1.Text) = False Then
oBook.SaveAs(TextBox1.Text)
MsgBox("Your file has been saved.")
ElseIf My.Computer.FileSystem.FileExists(TextBox1.Text) = True Then
If MsgBox("Prompt", MsgBoxStyle.YesNo, "Title") = MsgBoxResult.Yes Then
oBook.SaveAs(TextBox1.Text)
MsgBox("Your file has been saved.")
ElseIf MsgBox("Prompt", MsgBoxStyle.YesNo, "Title") = MsgBoxResult.No Then
Hide()
End If
End If
HIRA RASHEED
HIRA RASHEED
推荐答案
此论坛是针对Visual Studio IDE的,您的问题与VB更为相关,我将其移至相应的论坛中,以获取专业的答案.
This forum is for Visual Studio IDE, your issue is more related to VB, I'll move it to corresponding forum for you to get a professional answer.
感谢您的理解.
最诚挚的问候
抓取
这篇关于如果文件不存在,如何保存文件....但是,如果文件确实存在,请询问用户是否要覆盖,并且仅在单击“是"时才保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!