VB Project... To help me learn

GZ

Visiting Expert
Joined
Apr 8, 2012
Posts
1,304
Location
New Jersey
Okay... So I am trying to learn VB...

I came up with (what should be) a simple program to help me learn how things work... If you all wouldn't mind helping me get started.

My understanding of the language is sketchy at best. I have my wife to help me, but she gets short with me quickly. Last night I asked her for help and she gave me a short answer followed with "I don't understand why you can't... blah... blah... blah". So I set out to figure it out on my own and ended up writing a batch script to do what I wanted (change directory focus before executing a program) instead of having subroutine do it.

Of course Visual Studio doesn't really help me too much... It's like using an HTML editor to write a page, vs. manually doing it. But that is how I learned HTML. I want to try and do the same thing here... Use VS10 to design most of the program then read the code to figure out what it does. (with help from the WWW).

Okay. What I want to do...

I have a file directory of karaoke songs (CDG+MP3) and a tab-delimited text file with the file names and the Song Artist/Title. Instead of manually renaming each of the 2000+ files I would like to write a program to do it for me.

Later on, I would like to add the functionality to compress both the .mp3 & .cdg files into zip containers using the same artist/title filename.


Please, if you have any comments or tips to help me get started and going in the right direction, feel free to throw in your two cents!
 
Let's see if I have the gist of how this should work.

The program will need to...

Read the tab delimited file
Assign variables to the file entries
Use those variables to locate the files and rename them.

The subprocess commands should be something like...

Code:
My.Computer.FileSystem.RenameFile("FileName.file", "NewFileName.file")
or
Code:
My.Computer.FileSystem.RenameFile("Variable1", "Variable01")

Am I on the right track, or am I out in left field?
 
Hello!

You seem to be picking up programming really quickly :)

I will need to check up how to access the designer produced code from your other thread - I know how to do it in C#, but I have a suspicion that it is different in VB.

Basically, the gist of it is that you are going to have to create an array of old names, and an array of new names, loop through the old names, and convert each to the new name.

What format exactly does this file take? It is something like (with \t for a tab, and \r\n for a newline)

Old_Name\tNew_Name\tArtist\r\n...{Next_Entry}...

I can then talk you through it. Very well done for the impressive results you have already achieved.

Richard
 
That is pretty much it...
Old_Name_Without_Extension^tArtist_Name^tSongName

It wouldn't be too hard to change it from tab delimiting to comma delimiting... I am not sure which works best with VB.

Thanks for the vote of confidence there, but the designer program did much of the work for me! All I had to do is add a few snippets of code...

I have been reading though and I *think* I am beginning to understand the basics of setting variables, Functions and Subroutines, and (just started looking into) arrays. Too much to take in at once...

I have to admit... I never learned well from a book... I always did much better by just doing it!!!

My last little shell app is going to get some added functionality... once I figure out how to do it!
 
Code:
My.Computer

Yikes, shouldn't do that, it's not part of the default .NET libraries and actually only really a Visual Basic reference as My.Computer namespace. Use the System.IO namespace as it has file methods that are just as suitable.

I have a file directory of karaoke songs (CDG+MP3) and a tab-delimited text file with the file names and the Song Artist/Title. Instead of manually renaming each of the 2000+ files I would like to write a program to do it for me.

Later on, I would like to add the functionality to compress both the .mp3 & .cdg files into zip containers using the same artist/title filename.

My advice:

-Look into the String.Split method
-Use System.IO instead of My.Computer whenever you can
-To compress to ZIP, I believe WinRar has this capability, 7zip is command line based as well I think, so you'll either have to utilize these tools, OR go into your own advanced method of compression probably; in which case you're going to want to learn Serialization...
 
Last edited:
Windows can, inherantly, compress to .zip... Why can't I just use it?

I can't quite remember off hand, but it is actually really difficult to access, and requires some nasty hack to go via explorer.exe/the shell, which is really messy. I usually use the Ionic Zip library, which has a nice permissive licence: http://dotnetzip.codeplex.com/
 

Has Sysnative Forums helped you? Please consider donating to help us support the site!

Back
Top