新聞中心
這里有您想知道的互聯網營銷解決方案
輕松打造VB.NET文件合并示例
VB.NET編程語言在文件的操作方面體現了非常大的作用。比如今天要為大家介紹的VB.NET文件合并,就可以應用VB.NET來輕松的實現。大家就一起來具體的解讀這段代碼來對此進行一個詳細的了解。

成都創(chuàng)新互聯服務項目包括武陵源網站建設、武陵源網站制作、武陵源網頁制作以及武陵源網絡營銷策劃等。多年來,我們專注于互聯網行業(yè),利用自身積累的技術優(yōu)勢、行業(yè)經驗、深度合作伙伴關系等,向廣大中小型企業(yè)、政府機構等提供互聯網行業(yè)的解決方案,武陵源網站推廣取得了明顯的社會效益與經濟效益。目前,我們服務的客戶以成都為中心已經輻射到武陵源省份的部分城市,未來相信會繼續(xù)擴大服務區(qū)域并繼續(xù)獲得客戶的支持與信任!
VB.NET文件合并代碼實現示例:
- Private Sub MergeFiles(ByVal
inputDir As String, ByVal
inputMask As String, ByVal
outputPath As String)- 'store files in datatable
with their created times
to sort by later- Dim files As New DataTable
- files.Columns.Add("filepath",
GetType(String))- files.Columns.Add("creationtime",
GetType(Date))- 'find partial files
- For Each f As String In IO.
Directory.GetFiles(inputDir, inputMask)- files.Rows.Add(New Object()
{f, IO.File.GetCreationTime(f)})- Next
- 'make sure output file does
not exist before writing- If IO.File.Exists(outputPath) Then
- IO.File.Delete(outputPath)
- End If
- 'loop through file in order,
and append contents to output file- For Each dr As DataRow In
files.Select("", "creationtime")- Dim contents As String =
My.Computer.FileSystem.ReadAllText
(CStr(dr("filepath")))- My.Computer.FileSystem.WriteAllText
(outputPath, contents, True)- Next
- End Su
VB.NET文件合并的相關實現方法就為大家介紹到這里。
【編輯推薦】
- VB.NET水晶報表優(yōu)點及結果描述
- VB.NET指針在實際應用中作用體現
- VB.NET List實用技巧詳解
- VB.NET文件名排序輕松掌握
- VB.NET IEnumerator接口操作代碼解讀
網頁名稱:輕松打造VB.NET文件合并示例
分享鏈接:http://www.5511xx.com/article/dpjdgei.html


咨詢
建站咨詢
