以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  文件保存提示  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=59918)

--  作者:weijun
--  发布时间:2014/11/13 14:20:00
--  文件保存提示

Dim Book As New XLS.Book(ProjectPath & "Attachments\\螺纹钢质量证明书.xls")
Dim fl As String = Tables("质量证明书").Current("尺寸") & "-" & Tables("质量证明书").Current("牌号") & "-" & Tables("质量证明书").Current("长度") & ".PDF"
Book.Build() \'生成细节区
Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog
dlg.Filter= "PDF文件|*.PDF" \'设置筛选器
dlg.FileName = fl
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
    Book.SaveToPDF(dlg.FileName) \'保存为PDF文件
   
    Dim Proc As New Process \'打开PDF文件
    Proc.File = dlg.FileName
    Proc.Start()
End If

 

保存时有相同的文件名出现提示对话筐代码怎样写?


--  作者:有点甜
--  发布时间:2014/11/13 14:23:00
--  

If FileSys.FileExists(dlg.FileName) Then
    msgbox("已存在")
End If


--  作者:weijun
--  发布时间:2014/11/13 15:27:00
--  
Dim Book As New XLS.Book(ProjectPath & "Attachments\\螺纹钢质量证明书.xls")
Dim fl As String = Tables("质量证明书").Current("尺寸") & "-" & Tables("质量证明书").Current("牌号") & "-" & Tables("质量证明书").Current("长度") & ".PDF"
Book.Build() \'生成细节区
Dim dlg As New SaveFileDialog \'定义一个新的SaveFileDialog
dlg.Filter= "PDF文件|*.PDF" \'设置筛选器
dlg.FileName = fl
If dlg.ShowDialog = DialogResult.Ok Then \'如果用户单击了确定按钮
If FileSys.FileExists(dlg.FileName) Then
 MessageBox.Show("是否覆盖相同文件", "提示", MessageBoxButtons.YesNo) 
 Book.SaveToPDF(dlg.FileName) \'保存为PDF文件
   
   
    Dim Proc As New Process \'打开PDF文件
    Proc.File = dlg.FileName
    Proc.Start()
    End If
End If

--  作者:有点甜
--  发布时间:2014/11/13 15:30:00
--  
If FileSys.FileExists(dlg.FileName) Then
    If MessageBox.Show("是否覆盖相同文件", "提示", MessageBoxButtons.YesNo) = DialogResult.Yes Then
        Book.SaveToPDF(dlg.FileName) \'保存为PDF文件
       
       
        Dim Proc As New Process \'打开PDF文件
        Proc.File = dlg.FileName
        Proc.Start()
    End If
End If