日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
VB.NET批量重命名修改大揭秘

學(xué)習(xí)VB.NET編程的都知道重命名的問題,隨著我在工作中的積累,對(duì)VB.NET批量重命名的代碼編輯上做了一些總結(jié),下面給大家列舉一個(gè)VB.NET批量重命名代碼實(shí)例,希望可以給大家?guī)韼椭?/p>

創(chuàng)新互聯(lián)長(zhǎng)期為近1000家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為寧城企業(yè)提供專業(yè)的成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站,寧城網(wǎng)站改版等技術(shù)服務(wù)。擁有十載豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

 
 
 
  1. Imports System.IO  
  2. Public Class Form1  
  3. Inherits System.Windows.Forms.Form  
  4. #Region " Windows 窗體設(shè)計(jì)器生成的代碼 "  
  5. Public Sub New()  
  6. MyBase.New()  
  7. '該調(diào)用是 Windows 窗體設(shè)計(jì)器所必需的。  
  8. InitializeComponent()  
  9. '在 InitializeComponent() 調(diào)用之后添加任何初始化  
  10. End Sub  
  11. '窗體重寫 dispose 以清理組件列表。  
  12. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)  
  13. If disposing Then  
  14. If Not (components Is Nothing) Then  
  15. components.Dispose()  
  16. End If  
  17. End If  
  18. MyBase.Dispose(disposing)  
  19. End Sub  
  20. 'Windows 窗體設(shè)計(jì)器所必需的  
  21. Private components As System.ComponentModel.IContainer  
  22. '注意: 以下過程是 Windows 窗體設(shè)計(jì)器所必需的  
  23. '可以使用 Windows 窗體設(shè)計(jì)器修改此過程。  
  24. '不要使用代碼編輯器修改它。  
  25. Friend WithEvents Button1 As System.Windows.Forms.Button  
  26. Friend WithEvents TextBox1 As System.Windows.Forms.TextBox  
  27. Friend WithEvents Button2 As System.Windows.Forms.Button  
  28. Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox  
  29. Friend WithEvents TextBox2 As System.Windows.Forms.TextBox  
  30. Friend WithEvents Button3 As System.Windows.Forms.Button  
  31. Friend WithEvents Label1 As System.Windows.Forms.Label  
  32. Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar  
  33. Friend WithEvents Label2 As System.Windows.Forms.Label  
  34. Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox  
  35. Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu  
  36. Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel  
  37. ()> Private Sub InitializeComponent()  
  38. Me.Button1 = New System.Windows.Forms.Button  
  39. Me.TextBox1 = New System.Windows.Forms.TextBox  
  40. Me.Button2 = New System.Windows.Forms.Button  
  41. Me.ComboBox1 = New System.Windows.Forms.ComboBox  
  42. Me.TextBox2 = New System.Windows.Forms.TextBox  
  43. Me.Button3 = New System.Windows.Forms.Button  
  44. Me.Label1 = New System.Windows.Forms.Label  
  45. Me.ProgressBar1 = New System.Windows.Forms.ProgressBar  
  46. Me.Label2 = New System.Windows.Forms.Label  
  47. Me.CheckBox1 = New System.Windows.Forms.CheckBox  
  48. Me.MainMenu1 = New System.Windows.Forms.MainMenu  
  49. Me.LinkLabel1 = New System.Windows.Forms.LinkLabel  
  50. Me.SuspendLayout()  
  51. '  
  52. 'Button1  
  53. '  
  54. Me.Button1.Location = New System.Drawing.Point(288, 120)  
  55. Me.Button1.Name = "Button1" 
  56. Me.Button1.Size = New System.Drawing.Size(112, 32)  
  57. Me.Button1.TabIndex = 0 
  58. Me.Button1.Text = "執(zhí)行" 
  59. '  
  60. 'TextBox1  
  61. '  
  62. Me.TextBox1.Location = New System.Drawing.Point(32, 40)  
  63. Me.TextBox1.Name = "TextBox1" 
  64. Me.TextBox1.Size = New System.Drawing.Size(272, 21)  
  65. Me.TextBox1.TabIndex = 1  
  66. Me.TextBox1.Text = "TextBox1" 
  67. '  
  68. 'Button2  
  69. '  
  70. Me.Button2.Location = New System.Drawing.Point(336, 40)  
  71. Me.Button2.Name = "Button2" 
  72. Me.Button2.Size = New System.Drawing.Size(104, 23)  
  73. Me.Button2.TabIndex = 2  
  74. Me.Button2.Text = "目標(biāo)文件夾..." 
  75. '  
  76. 'ComboBox1  
  77. '  
  78. Me.ComboBox1.Location = New System.Drawing.Point(168, 88)  
  79. Me.ComboBox1.Name = "ComboBox1" 
  80. Me.ComboBox1.Size = New System.Drawing.Size(80, 20)  
  81. Me.ComboBox1.TabIndex = 3 
  82. Me.ComboBox1.Text = "ComboBox1" 
  83. '  
  84. 'TextBox2  
  85. '  
  86. Me.TextBox2.Location = New System.Drawing.Point(168, 128)  
  87. Me.TextBox2.Name = "TextBox2" 
  88. Me.TextBox2.Size = New System.Drawing.Size(80, 21)  
  89. Me.TextBox2.TabIndex = 4 
  90. Me.TextBox2.Text = "" 
  91. '  
  92. 'Button3  
  93. '  
  94. Me.Button3.Location = New System.Drawing.Point(40, 128)  
  95. Me.Button3.Name = "Button3" 
  96. Me.Button3.Size = New System.Drawing.Size(80, 23)  
  97. Me.Button3.TabIndex = 5 
  98. Me.Button3.Text = "新增文件類型" 
  99. '  
  100. 'Label1  
  101. '  
  102. Me.Label1.Location = New System.Drawing.Point(40, 88)  
  103. Me.Label1.Name = "Label1" 
  104. Me.Label1.Size = New System.Drawing.Size(104, 23)  
  105. Me.Label1.TabIndex = 6 
  106. Me.Label1.Text = "要操作的文件類型" 
  107. '  
  108. 'ProgressBar1  
  109. '  
  110. Me.ProgressBar1.Location = New System.Drawing.Point(40, 168)  
  111. Me.ProgressBar1.Name = "ProgressBar1" 
  112. Me.ProgressBar1.Size = New System.Drawing.Size(352, 16)  
  113. Me.ProgressBar1.TabIndex = 7 
  114. '  
  115. 'Label2  
  116. '  
  117. Me.Label2.Location = New System.Drawing.Point(32, 192)  
  118. Me.Label2.Name = "Label2" 
  119. Me.Label2.Size = New System.Drawing.Size(240, 24)  
  120. Me.Label2.TabIndex = 8 
  121. Me.Label2.Text = "狀態(tài)" 
  122. '  
  123. 'CheckBox1  
  124. '  
  125. Me.CheckBox1.Location = New System.Drawing.Point(304, 80)  
  126. Me.CheckBox1.Name = "CheckBox1" 
  127. Me.CheckBox1.Size = New System.Drawing.Size(136, 24)  
  128. Me.CheckBox1.TabIndex = 9 
  129. Me.CheckBox1.Text = "完成后打開文件夾" 
  130. '  
  131. 'LinkLabel1  
  132. '  
  133. Me.LinkLabel1.Location = New System.Drawing.Point(296, 200)  
  134. Me.LinkLabel1.Name = "LinkLabel1" 
  135. Me.LinkLabel1.Size = New System.Drawing.Size(144, 23)  
  136. Me.LinkLabel1.TabIndex = 10 
  137. Me.LinkLabel1.TabStop = True 
  138. Me.LinkLabel1.Text = "http://www.wgscd.com" 
  139. '  
  140. 'Form1  
  141. '  
  142. Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)  
  143. Me.ClientSize = New System.Drawing.Size(464, 238)  
  144. Me.Controls.Add(Me.LinkLabel1)  
  145. Me.Controls.Add(Me.CheckBox1)  
  146. Me.Controls.Add(Me.Label2)  
  147. Me.Controls.Add(Me.ProgressBar1)  
  148. Me.Controls.Add(Me.Label1)  
  149. Me.Controls.Add(Me.Button3)  
  150. Me.Controls.Add(Me.TextBox2)  
  151. Me.Controls.Add(Me.ComboBox1)  
  152. Me.Controls.Add(Me.Button2)  
  153. Me.Controls.Add(Me.TextBox1)  
  154. Me.Controls.Add(Me.Button1)  
  155. MeMe.Menu = Me.MainMenu1  
  156. Me.Name = "Form1" 
  157. Me.Text = "批量重命名 wgscd 2005" 
  158. Me.ResumeLayout(False)  
  159. End Sub  
  160. #End Region  
  161. Dim Path As String = "" 
  162. Dim Filter As String = "*.*" 
  163. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click  
  164. Filter = Me.ComboBox1.SelectedItem  
  165. Dim dir As DirectoryInfo  
  166. Path = Me.TextBox1.Text  
  167. If Path <> "" AndAlso Me.ComboBox1.Text <> "" Then  
  168. ' If Me.TextBox1.Text.Trim.Length > 6 Then  
  169. '  MsgBox("文件類型錯(cuò)誤")  
  170. '  Exit Sub  
  171. '  End If  
  172. Dim D As New DirectoryInfo("Temp")  
  173. If D.Exists = False Then  
  174. D.Create()  
  175. End If  
  176. dir = New DirectoryInfo(Me.TextBox1.Text)  
  177. Dim lenth As Integer = dir.GetFiles(Filter).Length  
  178. If lenth > 0 Then  
  179. Me.ProgressBar1.Value = 0 
  180. Me.ProgressBar1.Maximum = lenth + 1  
  181. Me.Label2.Text = "正在復(fù)制到臨時(shí)目錄。。。" 
  182. Dim fi As FileInfo  
  183. Dim i As Integer = 1 
  184. For Each fi In dir.GetFiles(Filter)  
  185. Dim Temp As String = fi.Name  
  186. Dim Extention As String = fi.Extension  
  187. fi.CopyTo("Temp\" & i & Extention, True)  
  188. fi.Delete()  
  189. i += 1  
  190. Me.ProgressBar1.Value = i 
  191. Next  
  192. Me.ProgressBar1.Value = 0 
  193. Me.Label2.Text = "復(fù)制到臨時(shí)目錄完成" 
  194. Me.Label2.Text = "正在刪除臨時(shí)文件。。。" 
  195. dir = New DirectoryInfo("Temp")  
  196. If dir.GetFiles(Filter).Length Then  
  197. Dim fi2 As FileInfo  
  198. Dim j As Integer = 1 
  199. For Each fi2 In dir.GetFiles(Filter)  
  200. Dim Temp As String = fi2.Name  
  201. Dim Extention As String = fi2.Extension  
  202. fi2.CopyTo(Path & "\" & j & Extention, True)  
  203. fi2.Delete()  
  204. j += 1  
  205. Me.ProgressBar1.Value = j 
  206. Next  
  207. Me.Label2.Text = "處理完成" 
  208. If Me.CheckBox1.Checked Then  
  209. Dim p As New Process  
  210. p.Start(Path)  
  211. End If  
  212. End If  
  213. Else : Exit Sub  
  214. End If  
  215. Else  
  216. MsgBox("請(qǐng)選擇設(shè)置操作路徑和要文件類型")  
  217. End If  
  218. End Sub  
  219. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  
  220. Me.TextBox1.Text = System.Environment.GetFolderPath(Environment.SpecialFolder.MyPictures)  
  221. Me.ComboBox1.Items.AddRange(New String() {"*.*", "*.jpg", ".gif", "*.bmp", "*.tif", "*.png", "*.html", "*.htm", "*.asp", "*.aspx"})  
  222. ComboBox1.SelectedIndex = 1  
  223. TextBox2.Text = "例如*.jsp" 
  224. End Sub  
  225. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click  
  226. If TextBox2.Text <> "" Then  
  227. If Me.TextBox2.Text.Trim Like "*.*" Then  
  228. Me.ComboBox1.Items.Add(TextBox2.Text.Trim)  
  229. MeMe.ComboBox1.SelectedIndex = Me.ComboBox1.Items.Count - 1  
  230. End If  
  231. End If  
  232. End Sub  
  233. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click  
  234. Dim ofd As New FolderBrowserDialog  
  235. If ofd.ShowDialog = DialogResult.OK Then  
  236. Me.TextBox1.Text = ofd.SelectedPath  
  237. End If  
  238. End Sub  
  239. Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked  
  240. Dim p As New Process  
  241. p.Start(Me.LinkLabel1.Text)  
  242. End Sub  
  243. End Class 

以上就是VB.NET批量重命名處理,大家試試吧!

【編輯推薦】

  1. 程序員必看VB.NET CASE語句拓展篇
  2. 深入介紹VB.NET類庫 SmartRWLocker技巧
  3. VB.NET復(fù)制讀取音頻文件到剪貼板小技巧
  4. 深入概括VB.NET運(yùn)行環(huán)境
  5. 快速使用VB.NET搜索程序?qū)嵗?/li>

網(wǎng)站題目:VB.NET批量重命名修改大揭秘
網(wǎng)站地址:http://m.5511xx.com/article/dpcoego.html