网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

VB.NET中怎么对文件进行合并

本篇文章给大家分享的是有关VB.NET中怎么对文件进行合并,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

我们提供的服务有:成都做网站、成都网站制作、微信公众号开发、网站优化、网站认证、日照ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的日照网站制作公司

VB.NET文件合并代码实现示例:

  1. Private Sub MergeFiles(ByVal 
    inputDir As String, ByVal 
    inputMask As String, ByVal 
    outputPath As String)  

  2. 'store files in datatable 
    with their created times 
    to sort by later  

  3. Dim files As New DataTable  

  4. files.Columns.Add("filepath",
     GetType(String))  

  5. files.Columns.Add("creationtime",
     GetType(Date))  

  6. 'find partial files  

  7. For Each f As String In IO.
    Directory.GetFiles(inputDir, inputMask)  

  8. files.Rows.Add(New Object() 
    {f, IO.File.GetCreationTime(f)})  

  9. Next  

  10. 'make sure output file does
     not exist before writing  

  11. If IO.File.Exists(outputPath) Then  

  12. IO.File.Delete(outputPath)  

  13. End If  

  14. 'loop through file in order, 
    and append contents to output file  

  15. For Each dr As DataRow In 
    files.Select("", "creationtime")  

  16. Dim contents As String = 
    My.Computer.FileSystem.ReadAllText
    (CStr(dr("filepath")))  

  17. My.Computer.FileSystem.WriteAllText
    (outputPath, contents, True)  

  18. Next  

  19. End Su 

以上就是VB.NET中怎么对文件进行合并,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。


分享名称:VB.NET中怎么对文件进行合并
文章路径:http://bjjierui.cn/article/gidded.html

其他资讯