源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

自己写的文件操作的function和Sub vb.net dll

  • 时间:2021-05-29 20:48 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:自己写的文件操作的function和Sub vb.net dll
'原来用VB写的封装成dll供asp使用,后来升级到vb.net '这个是我以前写的电影站影片处理的一部份,程序挺简单的,没怎么注释,大家对付看 'program by someeyes '需要声明Imports System.IO命名空间     Public Function myFileExists(ByVal pathName As String) As String '检查文件是否存在         If File.Exists(pathName) = False Then             myFileExists = "<font color=""Red"">文件丢失</font>"         Else             myFileExists = "<font color=""#0066ff"">文件存在</font>"         End If     End Function     Private sub myCreatDirectory(ByVal pathName As String) '创建文件夹         Try             If Directory.Exists(pathName) = False Then                 Directory.CreateDirectory(pathName)             End If         Catch e As Exception             myErrMsg = myErrMsg & "创建" & pathName & "文件夹的时候出现一个意外的错误."             myErrMsg = myErrMsg & e.ToString             HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")         End Try     End Sub     Private Sub myDelDirectory(ByVal pathName As String) '删除文件夹         Try             If Directory.Exists(pathName) = True Then                 Directory.Delete(pathName)             End If         Catch e As Exception             myErrMsg = myErrMsg & "删除" & pathName & "文件夹的时候出现一个意外的错误."             myErrMsg = myErrMsg & e.ToString             HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")         End Try     End Sub     Private Sub myMoveFile(ByVal pathName As String, ByVal target As String)  '移动文件夹         Try             File.Move(pathName, target)         Catch e As Exception             myErrMsg = myErrMsg & "从" & pathName & "移动文件到" & target & "的时候出现一个意外的错误."             myErrMsg = myErrMsg & e.ToString             HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")         End Try     End Sub     Private Sub myCopyFile(ByVal fsource As String, ByVal fdestination As String)         Try             File.Copy(fsource, fdestination, False)         Catch e As Exception             myErrMsg = myErrMsg & "从" & fsource & "复制文件到" & fdestination & "的时候出现一个意外的错误."             myErrMsg = myErrMsg & e.ToString             HttpContext.Current.Response.Write("程序遇到一个意外的错误,详细情况请查看日志文件!<br>")         End Try     End Sub
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部