Microsoft Visual Basic.NET, also known as VB.NET, is an object-oriented computer programming language developed by Microsoft. It's commonly used due to its flexibility and ease of use. A file extension identifies the file format of the contents in a file. It's useful to know how to change file extensions in VB.NET in case you need to change extensions of many of files manually.
- Skill level:
Other People Are Reading
Open Microsoft Visual Basic Express, click "New Project..." under the "File" menu, then select "Windows Forms Application." Click "OK."
Double-click "Button" on the "Toolbox" pane. Double-click "Button1" to open the "Form1.vb"module. Press "Ctrl" and "A" to select code then press "Delete" to remove existing code.
Copy and paste the following code into your "Form1.vb ":
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim my Files As String() my Files = IO.Directory.GetFiles("D:\Temp\", "*.txt") Dim newFilePath As String For Each filepath As String In my Files newFilePath = filepath.Replace(".txt", ".html") System.IO.File.Move(filepath, newFilePath) Next End Sub
Edit the following line of code with your own path and file extension:
my Files = IO.Directory.GetFiles("D:\Temp\", "*.txt")
Edit the following line of code with your existing and new file extensions:
newFilePath = filepath.Replace(".txt", ".html")
Press "F5" to run your program, then press "Button1."
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for