rename file based on textbox contents

I'm attempting to write a VB.Net program that renames a .mov file based on user entries in a series of textboxes.   i.e. Box1 = dog.mov,  Box2 = lp124,  Box3 = tues with a desired output of a file rename as lp123_tues.mov

I have 10 rows of 3 columns so that I can process 10 different files at once.

Any help would be greatly appriciated.
Judson HallSystems AdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vb_jonasCommented:
Dim oldfilename As String
dim newfilename as string
newfilename=box2.text & "_" & box3.text & microsoft.visualbasic.right(box1.text,4)

My.Computer.FileSystem.RenameFile(oldfilename, newfilename)

' or microsoft.visualbasic.filesystem.rename oldfilename, newfilename
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jorge PaulinoIT Pro/DeveloperCommented:
I think it is:

Dim filenamepath As String = YourFilePath ' (you can get this using System.IO namespace)
Dim oldfilename As String = filenamepath & "\" & Box1.Text
dim newfilename as string = filenamepath  & "\" & Box2.Text & "_" & Box3.Text & ".mov"

My.Computer.FileSystem.RenameFile(oldfilename, newfilename)
0
Judson HallSystems AdminAuthor Commented:
Getting closer .... Attached is the code I have so far and a gif of the interface I'm working with ... of course I'll have to start a thread that will step through the additional rows (i.e. orig1.text, orig2.text, orig3.text and the associated textboxes.


Thanks for the assistance
Imports System.IO
 
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        If FolderBrowserDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            Label1.Text = FolderBrowserDialog.SelectedPath
 
        End If
 
    End Sub
 
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
 
        Dim filenamepath As String = Label1.Text ' (you can get this using System.IO namespace)
        Dim oldfilename As String = filenamepath & "\" & Orig1.Text
        Dim newfilename As String = filenamepath & "\" & HouseNum1.Text & "_" & ISCI1.Text & "_" & Length1.Text & "_" & Title1.Text & ".mov"
 
        Microsoft.VisualBasic.FileSystem.Rename(oldfilename, newfilename)
 
    End Sub
 
End Class

Open in new window

avidconvert.gif
0
Jorge PaulinoIT Pro/DeveloperCommented:
What are the problem now ?

Another thing ... why don't you use a listview or datagridview for that ?
0
Judson HallSystems AdminAuthor Commented:
Thanks guys! I'll post another question about datagridview and list view .
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.