Posted  by  admin

Visual Basic 2010 Express Offline Music Apps

Visual Basic 2010 Express Offline Music Apps 6,1/10 5453 votes

Visual C 2010 Express Edition provides a complete integrated development and debugging environment making it the easiest way to create custom, powerful applications using the C/C language. Visual C 2010 Express Edition also contains an enhanced version of the C/C optimizing compiler for the fastest executables.

Free VB Code and Free Visual Basic.NET Source code, Examples, Tutorials, Links, and other resources - VBFORFREE.COM is another one of my VB sites with many articles, source code snippets, tutorials, and more for ALL VB's. November 22nd 2011 - I added a new version of the csEasyEncoder EXPress Edition program. It has been updated to version 2011. The major new features includes the ability to specify the B-Frames and Reference Frames to use for the video encode, mainly for MPEG based formats. Also included is the ability to specify both the Resolution and the Aspect Ratio to use when encoding your video files. Another addition is the ability to use video de-interlacing when encoding the video file.

I likewise added the latest ffmpeg.exe encoder and the changes that needed to be made for the program to be compatible with the new version of the ffmpeg encoding library. Some minor changes was made as well like cleaning up some code and trying to make some of the code more efficient. The main download for the compiled program and setup installer is under the Software section.

The example source code for Visual Basic.NET 2010 is on the Examples webpage and under the VB 2005 and Higher section near the bottom of that page. Hopefully the update will be useful to you.:). October 3rd 2011 - A new example for VB 2005 and Higher has been added on how to very easily do Simple Zipping and Unzipping of files using the DotNetZip library. The example itself is pretty simple and basic. It highlights the basic functions of the DotNetZip library to zip-up and compress multiple files, then unzip and uncompress the files to a specific location. I do have some other code outlined as well though like getting progress updates for the zipping and un-zipping operations along with how to create a self-extracting.exe file using the DotNetZip class. The example was made with Visual Basic 2008 but the source code is compatible with VB.NET 2005 and VB 2010 as well.

Located on the - Visual Basic.NET - Examples page near the bottom of the page under the VB 2005 and Higher section. September 23rd 2011 - I added a new example called csEasyMailer v1.0. It is a complete program with many advanced features for sending email messages using SMTP with Google Gmail, Microsoft Hotmail, and Yahoo as the smtp host. It has full support for multiple recipients, multiple carbon copies (cc), multiple attachments and much more. It also can send email as plain text and as html. You can send multiple email views which will allow the email provider to decide which view to show to the user. It has basic contacts support and support for sending email messages with a custom html based signature.

It has a feature that will allow you to preview your html email viewing its full formatting and all. It was made with VB 2008, but the codes will work in Visual Basic.NET 2005, and Visual Basic 2010. Located in the VB.NET - Examples section near the bottom of the page. I will have a new v1.5 version done later on that fixes some issues and has better support for saving contacts and such.

June 28th 2011 - A new example for Visual Basic.NET 2005, 2008, and VB 2010 has been added. I used Visual Basic 2008 but the code itself is usable in basically all dotNets. The example is on how to get the computers total cpu usage and display that value as text in the windows system icon tray. It will also plot a graph of the cpu usage history with lines. It uses the GetSystemTimes API call to get the total cpu usage.

This is similar to the sysmonlite example but more refined and more features. So if you want to know how to put or add text to the system tray, or icon tray as some call it, then check this example out.

Located at the VB.NET - Examples, page under the VB 2005 and Higher section near the bottom. April 21st 2011 - I added a new example on how to play embedded wave files compatible with VB.NET 2005, VB 2008, and Visual Basic.NET 2010. Shows adding a.wav file to your project and then setting the Build Action to Embedded Resource. Shows how to access the wave file through The Reflection.Assembly class and accessing the: GetManifestResourceStream stream to pass to the wave player. Uses the SoundPlayer class in.NET 2.0 and above to perform the playback of the.wav file.

While.NET 1.0 and 1.1 based VB.NET supports embedded resource files, it would have to use the PlaySund api call to perform the playback. December 21st 2010 - Added a cool new program I called csEasyEncoder 2010 eXPress Edition for download and the source code in the VB.NET 2005/2008/2010 - Example page. This application will encode music and video's into other formats. It can convert MPEG4.MP4, Flash Video.FLV,.AVI, MPEG2.MPG using Video CD (VCD), SVCD (Super Video CD) and DVD quality presets to many different formats like thoses already mentioned and even HQ (High Quality) H.264 MP4, and Windows Media Video. Very easily convert Flash Video to or from.MP4 MPEG 4 or really most of the popular formats. You can also convert to.FLV Flash video. If you have a Music Video, or a video you only want the audio/sound/music from then this program will strip/save/convert the audio portion only and save it as a.MP3 or.WAV file!

There are more features and formats available but can't list them all here. This program uses the very nice FFMPEG.exe library to perform all of the encoding tasks. FFMPEG has been around for awhile and has grown into a very popular and easy to use commandline utility for encoding/decoding media files and more. This program completely interacts with the ffmpeg.exe file and gives you a fully working gui without the user ever seeing a console window or even suspect the encoding is coming from a external.exe library. The example shows how to send input commands and flags plus parse the output from the library to provide progress and media statistics to display to the user.

So if you ever wanted to make your own Visual Basic based Video/Music encoding program without all of the major bit manipulating or paid libraries, then check out this example with the ffmpeg.exe library. This is also the first program and example i've made with Visual Basic 2010 thus far. I actually used the Express edition of VB.NET. The source code is 100% compatible with older versions of dotNet as well. I may port it down to a older version of Visual Studio.NET at a later date though. The program also takes advantage of multi-core cpus/processors (Dual Core, Quad Core, Hex Core), using multi-threading where possible. Some formats like wmv and flv only support a single thread though.

Anyways, the csEasyEncoder 2010 eXPress setup download for the program is under the Downloads - Software page and the full source code along with the ffmpeg.exe and x.264 hq based preset files are located under the: Visual Basic.NET - Examples page, in the Visual Basic 2005/2008/2010 only section. Have fun!:).

November 13th 2010 - A new example has been added using VB.NET 2005 (The source code itself is usable in basically ALL versions of.NET). The example is how to determine if the operating system your program is running on is 32-Bit (x86) or 64-Bit (x64) and whether your program itself is running in 64 Bit (x64) mode or in 32 Bit (x86) mode. I include about 5 methods to determine the addressing mode the OS is running on and about 4 ways to determine which mode your application itself is running in. Some of the methods I use is checking a registry key, using environment variables querying the 'PROCESSORARCHITECTURE' and 'PROCESSORIDENTIFIER' variables, API calls like GetSystemInfo/GetNativeSystemInfo, WMI and more! You should have a pretty good idea about the computers addressing environment after using the methods in this example. The example is located under: Visual Basic.NET - Examples page under the VB 2005/2008/2010 section called: Check If OS is 32 Bit or 64 Bit. I should also mention that Visual Basic 2010 (Really.NET Framework 4.0) has a new feature built-in called: Environment.Is64BitOperatingSystem, which is a property that will return True if the operating system is 64Bit and False if the os is NOT 64 bit (x64) but is 32 Bit (x86).

October 12th 2010 - A new and perhaps unique vb.net based application, setup, and example program called: csYoutubeDownload XPress1 for downloading youtube video's has been added. The example app actually has some slightly advanced features and shows how to download a backup of your youtube video files using DownloadFileAsync, and use DownloadData for downloading into memory which I use to save a copy of the thumbnail image associated with the youtube.com based video and how to use a couple url tricks to get google to give you the video download in the mpeg4,.mp4 based format if its available and the normal.flv format (Flash Video) format. This example uses the DownloadFileAsync feature of the.netframework to download the video's and will provide alot of various info about the download like the download speed, elasped time, how much time is left for the video to be finished and much more!

It can also tell you the title of the video, format types. I use a simple little class I found at thecodeproject.com which will format the youtube based url's into downloadable urls straight to the video. I made this program for my personal use and educational purposes. You should not use it to download any videos other than the ones you uploaded yourself. So please keep that in mind if you decide to use any code from this example. Also included a setup project in case you ever want to export your program using a pretty cool setup utility that you have quite a bit of control over compared to the very limited clickonce utility that is included in the express edition ide's.

Anyways, this program was made with Visual Basic.NET 2008 that targets.NET 2.0. The source code will work perfectly fine in Visual Basic 2005 and VB 2010. I mainly used VB 2008 because the actual program needs elevated permissions (Admin Access) to work properly and uac (User Account Control) is much easier to implement using VB 2008 than VB 2005 which you have to do a hack to request elevated uac access. The example download includes both the program project source, plus the setup project in the same solution. The compiled setup program is available in the Software section of this website. Anyways, Have fun!

July 18th 2010 - Added a new example using Visual Basic.NET 2005 but is fully compatible with VB 2008 and Visual Basic 2010. The example is how to download files from the internet and then save the contents to the computers hard drive, usb drive or other location on the target computer. I use the Webclient class and more specificially the Webclient.DownloadFileAsync subroutine. I use this sub to download files to the computer from a url/uri and add 3 different handlers to fire a couple methods to get progress information and such. Some of the features are getting the bytes the download is currently at, how big the download is. I also added custom code on getting the approximate download speed the file is downloading at in both Kilo-Btyes and in Kilo-Bits format, and more minor features like the elapsed time for the current download is included. Another advantage of using the DownloadFileAsync sub instead of the normal DownloadFile sub is that it won't consume your applications thread.

In other words your application will still respond and be usable while its downloading. The normal DownloadFile will make your application freeze unless you run it in a seperate thread apart from your main programs thread. Located on the Visual Basic.NEt - Examples page under the VB.NET 2005 section. July 18th 2010 - I finally got around to make a simple program and update the website. I want to mention that the example also includes a project I made for this program on making and customizing a setup project/executable for your programs. It shows many things you can do with the setup options like specify the background image of the setup dialogs, custom icons to use, setting up your shortcuts into the start menu, desktop, and much more!

Definitely worth checking out if your wanting to know alittle bit abount the Setup project type. Anyways, the new program is called csCPUTargeting eXPress v1.0. What this program does it help make the task of Targeting a cpu artchitecture alitte easier than doing it manually using the Express Editions of Visual Basic. Basically the problem with VB Express 2005, 2008, and VB 2010 is that Microsoft removes the simple option of targeting either a 32-bit cpu or 64-bit cpu for your applications. If you ever get a crash with: BadImageFormatException error with the message: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)' it could be a cpu targeting problem.

Usually by default your applications uses the 'AnyCPU' targeting option which will run in both 32-bit (x86) and 64-bit (x64) operating systems. But lets say your accessing a regular C based.dll that was compiled and setup for the 32-bit x86 format and your application is running in 64-bit mode.

You could very well get that Incorrect Format crash since your targeting a x86, 32-bit assembly. By specifying your applications to run specifically in 32-bit mode your applications will interop just fine the way its meant to with x86 32-bit assemblies.

Anyways, what this tool does is load the.vbproj file for your project and add a line of xml code: ' '. Between those tags you can put either 'x86' for 32-bit or 'x64' for 64-bit targeting. The application makes it possible to add the code to either/both Debug and Release configurations. Then the tool will save the edited project.vbproj file with the changes you made. You also have the option to backup your original project file as well along with some other features. The compiled execute will be under the: Software section of the site and the programs source code will be on the: Visual Basic.NET - Examples webpage.

This tool was made using Visual Basic 2005 and includes some code commenting as well. Anyways, hopefully this application and/or source code will be useful to you. BTW, the XML added to the project file is: with either x86 or x64 inserted between the tags.:). December 30th 09 - Site has finally been updated with something! To bad its nothing much to write home about. But anyways, I've added a new application example called: csWindowsCDKeyTool v1.0 that will get the DigitalProductID of the installed operating system and then convert/decode/decrpyt that value which is the cd key for the windows currently installed.

The GetProductID key is located in the system registry under: 'HKEYLOCALMACHINE SOFTWARE Microsoft Windows NT CurrentVersion '. The code that does the actual transformation of the product id code into the windows cdkey was Not made by me.

The example lists the possible author of the code. Anyways, I added some other stuff to the app that will get alot of various info on the windows installation, like whether windows is 64-bit or 32-bit. The code uses wmi (Windows Management Instrumentation) using the System.Management.DLL reference and System.Management.ManagementClass plus the ManagementObject class to check whether the os is Windows 32 Bit or 64 Bit(32bit/64bit). The rest of the code uses the dotnet.net framework, and environment variables to get the info.

The cd key tool works with ALL versions of WindowsXP, Windows Vista, and Windows7 (Should work on the servers as well like Windows Server 2008). The example vb code is VB 2005 and Visual Basic 2008 compatible and located under the VB.NET 2005/2008 examples page. September 21st 08 - A new application called: csComputerInfoTool v1.2 - The Vista Edition has been added under the software section. The example is under the VB.NET 2005/2008 - Examples page. This app uses the registry, performance counters, Windows Management Instrumentation (WMI), and the.NET Framework to get alot of various info on the computers cpu/processor, motherboard, video card, memory/ram, c: hard drive, and the Windows OS. The tool was made with Microsoft Vista in mind but it may work fine in Windows XP.

Some features or problems could pop up though. IF you just want the example then the OS shouldn't matter unless a feature is not available in the older operating systems. August 5th 08 - A basic.NET 05/08 example has been added on how to get some lower level volume information about a hard drive or other disk drive. It uses the GetVolumeInformation API which returns the volumes serial number, filesystem, maximum supported characters and such.

Located on the VB.NET - Examples page under the VB 2005/2008 section. While this API does return a unique serial number when querying a hard disk drive, it is the serial number for the Volume and NOT the actual Manufactors serial number given to the harddrive. To get that you can use WMI (Windows Management Instrumentation) which 'should' give you the true serial number value for the harddisk. An example will be added soon. The WMI class you want to use is: 'Win32PhysicalMedia' and the property to use is: ' SerialNumber'. Just in case you wanted to know.:). July 15th 08 - I added a new example for VB 2005 and/or VB 2008 on how to play movies and videos on your windows desktop.

I also included code on how to set the transparency/opacity level for the movie window so you can see what is behind the screen only. I didn't include any position or resizing code since this simple example focuses on basic playing of videos and movies while setting the desktop as the parent for the movies window screen. The older csMovieLibrary for.NET has all of those features though if you want them and includes Much more as well (So does the VB 6 based Movie Module class library). While this project won't open in Pre-2005 ide's, the codes in this example should be compatible with 02/03 versions with just some minor code changes. Even VB6 can use the codes with code changes. I may include a example for VB 6 in the future though. I guess its also worth mentioning that this app plays most all of the popular movie formats including the normal.avi,.mpg,.mpeg,.wmv extensions.

But it can play mpeg4 divx, apples quicktime mov, and many others as long as the codec for that format is installed. Thats all for now! May 7th 08 - A new class has been added called csAudioCD Library v2.5 - The Professional and Enhanced Edition for VB 2005 and VB 2008. This is the ultimate class library made with Visual Basic 2005 to make a very feature rich audio CD player based application. There are over 50 features available and are very easy to understand and use.

Most all of the subs/functions/propertys are fully XML commented with descriptions and explanations. It of course has your basic play/stop/pause features but some of the other features include opening and closing the CDRom and/or DVDRom drive, auto-scan the computer for available CD/DVD drives and can detect whether a CD Disk is in the drive and see if its a audio cd or not. IT can return some useful info about the CD and about the tracks on the CD's. Has available different time-format features as well for getting the length and playing position for both the audio CD and the Tracks for the CD. Way to many features to list here.

A example application has also been added that shows how to use this library and implement some of its features. The compiled class by itself is on the VB.NET - Controls page and the Example application which already includes the compiled class.dll is available on the VB.NET - Examples page under the Visual Basic 2005 and Visual Basic 2008 section. I might release the source code to the class library soon. April 21st 08 - A new example for VB.NET 2005 and Visual Basic 2008 has been added that shows how to create a simple image or picture viewer and features a basic slideshow feature.

The slide show will go through the list of images while having a simple pause before each image changes. There is a audio sound or music feature as well if you want to play a audio file while the slideshow is running. The example shows how to use a sortedlist with a key and value related to that key to hold the entire path of the image but making it so the user will only see the filename instead of having to see the entire path with the filename. There are basic picture/image Left and Right rotation features as well.

Located in the VB.NET 2005/2008 - Examples page near the bottom of the page. April 6th 08 - There were two new examples added to the site. One is for Classic VB and the other is for VB.NET. They are both on how to hide or show the caret (blinking cursor) for a textbox and combobox control using the HideCaret and ShowCaret API calls.

Remember that the control whose caret you want to hide/show Must be the owner of the caret at the time of calling these APIs. Also when the control loses ownership of the caret it will reset the caret and you will have to call the HideCaret API call again. But if you want the caret (blinking, flashing; cursor or whatever you want to call it) to stay hidden try putting the HideCaret code in the controls GotFocus event. Which whenever the control gets focus, it will hide the caret from the user even if another control temorary gets ownership.

March 8th 08 - A new example for VB.NET has been added that will check a IP, URL, or UNC (Universal Naming Convention) name using the 'IsDestinationReachable' Windows API call to see if it is reachable or not. It can return the to and from speed of the network used to try and reach the destination along with the type of network available.

This can somewhat be considered a pinging example in a sense but you wouldn't get accurate reply times since the API will also get the Network type and the To/From speed before returning control to your application. But it would be good to see if a specified destination is available or not. VB 05/2008 already has a full Ping class for checking a destination. I would recommend you use that class if using those versions unless you want the network to/from speed or whatnot. March 5th 08 - An example for Visual Basic.NET has been added that shows how to convert Unix Time to a Structured Windows based time. It converts and displays the Unix time based on UTC Time and the Computers Local Timezone.

The example displays the current Timezone and the Timezone offset compared to UTC (Coordinated Universal Time or Universal Time Coordinate) as well. This example is compatible with all versions of.NET including VB 2005 and VB 2008. A simple upgrade process is all thats needed for 05/08. February 19th 08 - A new example for Visual Basic 6.0 and 5.0 has been added on how to get high resolution timing using the QueryPerformanceCounter and QueryPerformanceFrequency API counters. This timer supports sub-millisecond resolutions which is better than timeGetTime and far better than the getTickCount timer.

This timer will usually use a 3.6 Mhz clock on the motherboard for timing but sometimes it could use your processors rdtsc counter. Examine the QueryPerformanceFrequency returned data from its ByRef parameter to see what the ticks per second of the timer is. If the function returns a 0 then the computer does Not support the timer or you did NOT pass the APIs parameter ByRef(By Reference) which is Required.

Do Not pass the parameters for these two (2) QueryPerformance APIs ByVal(By Value) because they WILL fail. You Must pass them ByRef. IF you need very precise timing, then this counter should be the way to go.

February 18th 08 - Another example for Visual Basic.NET 2002/2003 and compatible with VB 2005/2008 has been added. This example shows how to perform basic Math calculations using string variables/objects. It shows the Addition, Subtraction, Multiplication, and Division based operators. The main purpose I guess is how to perform Math operations on Strings in a somewhat safer way. It basically uses the Val Function which will examine a string and if the string is a number or if the string starts with a number then it will convert a object/string to a double or a Char to a integer type. IF the string contains no number or doesn't begin with a number then it will simply return a 0 which will keep your application from throwing a improper casting error message and/or crashing. A VB 6.0 version may be put up soon.

February 17th 08 - A small example made with Visual Basic.NET has been added that shows how to use delegates and callbacks to create and use a higher resolution windows based API Event Timer. This example uses the timeSetEvent/timeKillEvent APIs which supports much higher resolutions than the original SetTimer/KillTimer APIs at about 1 milli seconds compared to 15-16ms. This timer is actually a part of the winmm.dll multi-media library that has most of the multi-media based apis like the Playsound and mciSendString apis. Anyways, its located in the.NET - Examples page. February 8th 08 - A new example made with Visual Basic.NET 2008 on using the Managed Windows API Timer from the DotNET Framework was added. The codes in this example is compatible with VB.NET 2005 but the project will Not load in 2005. The managed timer was added in version 2.0 of the framework which VB 2005 is based on.

This example shows how to create a timer and have it call a function of your choice each time the specified interval has elapsed. This timer appears to be a managed wrapper around the SetTimer/KillTimer APIs from the User32.dll library that I made a example for VB.NET a few weeks ago. The resolution is only about 15/16ms. You can try using the Un-Managed multi-media timeSetEvent/timeKillEvent APIs which supports resolutions up to 1ms and is based on the winmm.dll library. I do have a example on these multi-media apis but never released it.

I may do that later on though. January 28th 08 - I meant to post this along time ago but forgot too. Microsoft now has available all of the Visual Studio.NET 2008 Examples that were included with the RTM (Released To Manufacture) versions as a seperate download. There are actually very MANY examples available for Visual Basic 2008 that covers everything from Excel, Powerpoint to LINQ, Tablet Based Programming, Server based, and Database programming. While the examples may NOT open with VB 2005, the codes in many of the examples should work with Visual Basic 2005 as well. Obviously examples like LINQ based source code won't work with.NET 2005 since LINQ was not supported until VS 2008. Anyways, if your interested.

The download is alittle more than 9 MB, so if you have Dial-Up it may take awhile.:). January 17th 08 - A new example for Visual Basic 6.0 (the code in the example is VB 5.0 compatible) has been added that shows how to use the GetEnvironmentVariable API call function to access some pre-defined variables and get/retrieve their values. You can see some Environment Variables if you go to the 'Start' then 'Settings' menu and click on 'Control Panel'. Click on the 'System' icon and then the 'Advanced' tab.

Click on the button that says 'Environment Variables' which should display a window with pre defined variables and their values. January 16th 08 - I added Two (2x) new Examples for Visual Basic 6.0 (Codes should be usable in 5.0). Both examples are related to using two of the available system timers/counters. Since I have a few timer related examples for vb.net, I figured I would do the same for VB Classic. So one of these examples uses the GetTickCount API Function and the other example uses the timeGetTime API Function along with the timeBeginPeriod and timeEndPeriod API calls. The GetTickCount timer/counter supports about 15 ms resolutions, while the timeGetTime counter/timer supports up to 1 millisecond resolutions.

Go to the VB - Examples page under Timing to check out the examples. I might make 1 or 2 more Timing related examples for the VB.COM (5.0/6.0) versions using a Very High sub-millisecond Resolution performance counter-timer(QueryPerformanceCounter) and possibly another on a super high resolution timer(RDSC). Our Agreement: By downloading and/or using any of the code or resources from this site, you agree NOT to misuse and/or use for any malicious purpose. You agree NOT to steal or take any of the code with the intent of claiming it to be yours. You are free to use all of the code here in your projects and take bits and pieces of code as you like.

Please do not edit or take out the Title, By, Website, Email, Description, or Copyright information that the code may contain. Please do not do anything with this code here that you wouldn't want someone to do to yours. I am not responsible for anything that happens even if your using the codes and resources from this site. Visual Basic Code Source - Copyright 1999-2012.

Note You must have DirectX installed in order for the sample application to run. Contents Introduction A problem that afflicts me (and I've noticed many of my brethren) is the need to create a program to solve a task when there are already many perfectly suitable programs on the market for free or for very little cash.

The standard justification in my mind is that there isn't a program that does things the exact way I want them to. Now realistically, I tend to pick on programs that are within reach. After all, even if Word didn't suit my needs, I have no intention of writing my own word processing program from scratch. (Although at times, I keep thinking I could build a better version of Outlook. Yet I digress). Such is the case of creating a program to manage my digital music collection.

While there are many music players that include software to manage my collection, I wanted more. The problem, of course, is that no one's going to pay me to write such a thing. Or would they? While playing with the PDC builds of Yukon and Whidbey, I figured the best way to get to know the product was to build something.

I built a very basic MP3 player using Visual Basic.NET that stored its metadata in a Yukon database. As always with homegrown products, the app didn't go very far. Fast-forward and it's time to do it again—this time with Visual Basic Express and SQL Server Express. In fact the goal is to evolve the application over the beta cycle so that by the time these products are released, I'll have the player I've always wanted. And since you'll have the code too, you can make the player you've always wanted.

In case you're not aware, SQL Server Express is name for the new version of the product formally known as the Microsoft SQL Server 2000 Desktop Engine; MSDE 2000 for short. SQL Server Express is based upon the same core engine as SQL Server 2005. SQL Server Express will be the free, redistributable version of SQL Server 2005 that will be ideal for client applications that require an embedded database, new developers learning how to build data-driven applications, and small Web sites. SQL Express is included with all of the new Express developer tools recently announced (including Visual Basic Express).

When you install Visual Basic Express, you will be given an opportunity to install SQL Server Express. It will be installed under Program Files and create a named instanced called SQLEXPRESS. Designing the Catalog The first step in building the application is designing the database schema. For many people, tracking data starts with a simple list, often created with pen and paper. When they graduate to the digital world, many people start with Excel. After all, Excel is fast, support larges lists, supports filtering and sorting, and is easy to use. One problem with Excel is repeating data.

This seems like a good exercise in normalization. Take the following Excel spreadsheet: Figure 1. Tracking a recording in Microsoft Excel Looking at the data in the spreadsheet, you'll see we're tracking a bare minimum of data. Things like track duration, music category, etc. Are unimportant (at least in this first release). Normalizing is the process of taking large tables and breaking them down into smaller ones in order to remove (or at least reduce) unnecessary and duplicate information. SQL Server Express is a relational database management system that supports databases that follow the relational model.

The late E.F. Codd, in his paper 'A Relational Model of Data for Large Shared Data Banks,' first defined the relational model in 1970. The relational model is based upon relational algebra (Relations actually refer to what are more commonly referred to as tables). A part of normalization, a table design is tested against normal forms.

Normal forms that are in use are:. First normal form. Second normal form. Third normal form. Fourth normal form. Fifth normal form.

Boyce-Codd normal form. Domain/Key normal form This list was taken from Database Design for Mere Mortals, Second Edition, authored by Michael J. Mike's book covers normalization and database design extensively in an easy-to-read style and is highly recommended. The database for the music collection will only require a few tests to for this first iteration of the application. First Normal Form First normal form states that all column values are atomic.

Looking at the list of data in the Excel sheet, the only real column that's not atomic is the File Name column. This column could be broken down further into drive, path, file name, and file extension. However, for this application, this level of normalization doesn't really make sense. The application will be using all the parts as a single unit. Second Normal Form Second normal form states that the database must be in first normal form. Each table should contain data about a single entity.

The current table can easily be broken down into three tables: artists, recordings, and tracks. In breaking the data into local groupings, we need a way to uniquely identify an entity, such as a recording, in the table.

This is known as primary key. If possible, we'd prefer a natural primary key. A natural key is one that is based upon data within the table.

This data needs to be unique among entities and, if possible, does not change (or at least frequently). While the artist table could use the artist's name as its primary key, this would create a large key value when used in relationships. In addition, while not common, it's possible to have a duplicate artist name. With recordings and tracks, the possibility of duplicates grows. Therefore, it will be better to use a surrogate key.

In the case of all three tables it will be an auto-generated (identity) value in the form of a 32-bit integer. This will allow each table to contain about two billion records. With the data in multiple tables, we need a way to relate the data.

We'll do this using foreign keys. One way to figure out the relationships is to define them in sentences. For example:. An artist has recordings. A recording has tracks. (This implies that an artist has tracks that are grouped by recording.) Therefore, the recordings table will need to have a column that represents the artist who created the recording. In turn, the tracks table will need to have a column that references the recording on which the track appears.

Using joins, an inference we can make an inference about which artist recorded which track. At this point the table structure for the database would look like this: Figure 2. Logical database design in second normal form Third Normal Form and Beyond Third normal form requires that the database be in second normal form. All non-key fields must depend upon the primary key. A common problem at this point would be calculated columns.

The current schema defined thus far doesn't suffer from these problems. Take a look at the Further Reading section at the end of this article for materials related to database design, normalization and the relational theory. Mike Hernandez's book, for example, provides a few sample schemas. Building the Database With the schema defined, the database can now be defined in SQL Server Express. The Technical Preview does not include any graphical tools (although they will be available later in the pre-release cycle).

However, Visual Basic Express (as well as the other Express products) includes a set of graphical tools that can be used to define the database and its contained objects such as tables, views, and stored procedures. With Visual Basic Express started, go to the View menu and select the Server Explorer option. A tool window labeled Database Explore opens (see Figure 3). Database Explorer window in Visual Basic Express Right-click the available Database Connections node to display a menu providing options to add a connection or create a new database (see Figure 4). Create New SQL Server Database menu Select the Create New SQL Server Database option to open a simple dialog (see Figure 5) that allows you specify the SQL Server Express instance, login credentials and the new database name.

The database you create via this dialog will be stored in the default SQL Server Express data directory (typically C: Program Files Microsoft SQL Server MSSQL.1 MSSQL Data). If this is not acceptable, there are a couple of alternatives. SQL Server Express ships with the same OSQL.exe command-line tool as in previous versions of MSDE. In addition, the new SQLCMD.exe command-line tool is included. Either tool will let you issue a CREATE DATABASE statement that will give you full control over the database creation process. In addition, as mentioned before, a managed graphical environment for managing SQL Express instances will be available later in the beta cycle.

Create New SQL Server Database dialog However, there is another option in Visual Basic Express. Once a project has been created, there's an option to create a new database by selecting the Add New Item command from Project menu and selecting the Blank Database item in the list (see Figure 6). Add New Item-Blank Database Choosing this option and entering a name creates a new database file and log in the same directory as the project's source files (I encourage you to save your project first. Unlike previous editions of Visual Studio.NET, Visual Basic Express supports Zero Impact projects that behave similarly to those in Visual Basic 6.0 and earlier. Basically you can create a project, write some code, run it, play with it, and then just discard it without littering your hard drive with the detritus of projects that time forgot).

The database connection uses a new connection string setting, AttachDBFilename, to link to the database file. This option will force the database to be attached to the server when a connection is opened (if the database is not already attached). In addition, if AUTOCLOSE was enabled at database creation (which is the default for SQL Server Express databases), when an application shuts down, the database and log files can be managed as regular operating system files suitable for XCOPY deployment. Defining Tables With the database defined, you can create tables graphically or via T-SQL commands. A new feature of the Visual Database Tools is the ability to open a query window and execute a variety of commands, including SELECT, INSERT, and CREATE TABLE commands (see Figure 7). New Query Window with context menu displayed Creating tables with the New Table designer is similar in form and function to previous editions of the Visual Data Tools (as well as SQL Enterprise Manager and Access). The designer operates as expected.

Defining the tables for our application's small schema is quick and easy. To define the primary key, indexes, and relationships, there is a Table Designer menu item on the main menu bar and a corresponding toolbar. The following tables show the table definitions. None of the columns allow null values.

The sizes for the ArtistName, RecordingTitle, and TrackTitle were determined by the sizes supported by the ID3v1 specification (available at ). Artists Table. Column Name Data Type Notes TrackID int Primary key, identity TrackTitle varchar(30) RecordingID int Foreign key TrackSequence tinyint TrackFileName nvarchar(260) Defining Relationships and Additional Indexes With the tables defined, the next step is to define the relationships between the tables, adding additional indexes as necessary. To define a relationship using the Visual Data Tools, you need to open the table in design view via the Open Table Definition command (available when right-clicking a table in the Database Explorer window).

Once you've opened the table, the Relationships command is available off of the Table Designer menu (or its corresponding toolbar). Selecting the command will open the Foreign Key Relationships dialog. A table can have any number of relationships and constraints defined. Click the Add button to create a new constraint (see Figure 8). In order to define a relationship, you must set the Tables and Column Specification property.

To set it, click the editor button in the property (see Figure 8) to open the Tables and Columns dialog. This is where the actual columns are matched up for the relationship (see Figure 9).

Foreign Key Relationships dialog Figure 9. Table and Columns dialog Closing the dialogs and then saving the table will cause the 'save changes to your database' warning message to appear (see Figure 10).

The changes can be applied, cancelled, or saved out to a script file to be executed later. Once you've defined all the relationships (the sample database only has two at this time), you can add additional indexes.

So far, each table has one index defined for the primary key column. Additional indexes can increase performance when searching for data and when performing joins between tables. However, indexes can also slow down insert operations. Since the database will be predominately used for read operations, adding indexes for the foreign key columns and for the text columns seems appropriate. 'Save changes to your database' warning message To add or modify a table's indexes, you must open the table in design mode. The Indexes/Keys dialog, available via the Table Designer menu provides the UI to add, modify, or remove indexes and keys on a table-by-table basis.

Figure 11 displays the dialog with a new index added for the ArtistsName column in the Artists table. Closing the dialog and saving the table applies the changes. Indexes/Keys dialog Working with Data With the schema defined, the next step is to get some sample data into the database. This is a good way to check to see if all the relationships are defined correctly. The Visual Data Tools make it easy. Simply right-clicking a table and selecting the Show Table Data command opens the data grid window for entering data.

In fact, you can copy all twelve rows of track data from Excel and paste them directly into the tracks data with correct creation of the identity values. How cool is that? Figure 12 shows all three tables with the sample data loaded. Setting up the windows, one on top of the other, is simple. Just open all three tables and then drag the tab for one window down the screen until a window frame appears; repeat one time and arrange windows to taste. All Three Tables with Sample Data Loaded If using the interactive grid doesn't suit you, the New Query command (available when right-clicking the database in the Database Explore window) will open the Query Editor, which enables you to execute of T-SQL commands to insert data.

Creating the User Interface With the database created, the next step is creating the user interface. Using Visual Basic Express to build a Windows Forms GUI is pretty addictive.

Snap-lines that help you position and align controls on the design surface are just pure happiness, and the new drag-and-drop data binding also provides a warm and fuzzy feeling (which will be covered a bit later). User interfaces, especially for fun projects, can be a very personal issue. I really didn't want to go with 'battleship' grey so I whipped up a small bit of code to create forms and panel controls with rounded corners. For the first iteration, you'll create all the necessary code in a single project. In the future, it would be nice to pull out items and create a reusable library. Figure 13 shows the main player window in all its blue, rounded glory.

Additional screens will be created a bit later. Music Express Beta 1 Playing MP3 Files While the Visual Basic Express toolbox is rich with wonderful components and controls, old and new, there doesn't appear to be one that plays MP3 files. The new SoundPlayer component only supports WAV files.

If possible, I wanted to avoid P/Invoke. A little research and I found what I wanted: the managed DirectX libraries provide an Audio class that lives in the Microsoft.DirectX.AudioVideoPlayback.dll assembly. This class supports MP3, WMA, and other audio file types. The Audio class has two overloaded constructors. One takes a file name to an audio file; the other adds a Boolean value to specify that the file should begin playing once opened. In addition, there are two shared members for opening a file. The FromFile method duplicates the behavior of the instance constructor that doesn't auto-play the file.

The FromURL method supports running the file from an HTTP stream. For the application, create a module level variable using the WithEvents keyword. The Audio class exposes Stopping and Pausing events (as well as a few others) that the application will use to keep the UI in sync. The Play File button uses the Open File dialog component to enable the user to browse for an MP3 file. Once the file has been selected, the MP3 metadata is parsed, and the song begins to play. Below are the core routines to define the audio instance, pick a file, and then play the file. ALTER PROCEDURE dbo.GetAllTracks AS SELECT TrackID, TrackTitle, RecordingID, TrackSequence, TrackFileName, CONVERT(varchar(3), TrackSequence) + ' - ' + TrackTitle AS TrackDisplayInfo FROM Tracks ORDER BY RecordingID, TrackSequence RETURN In addition to returning the rows, the stored procedure returns a calculated column, TrackDisplayInfo.

Generally, it's more efficient to have the data loaded into a client data structure, such as a DataSet, in the sort order that will be used most often. The same thing applies to calculated columns. The TrackDisplayInfo column will be used by the UI for track selection.

Getting access to the stored procedures using code would be very similar to the code used earlier. However, I wanted to write less code, not more. In addition, Visual Basic Express includes some really nice data binding enhancements. As mentioned earlier, adding a database to a project also adds a DataSet. Opening the DataSet Designer provides a nicely colored design surface with hints to add items from the Database Explorer or Toolbox. Do so, dragging and dropping tables and stored procedures on to the design surface. Using the Relation object off of the toolbox, you can define the relationships between the stored procedures.

Figure 15 shows the configured DataSet in the DataSet Designer. Figure 16 shows the Edit Relation dialog in action.

The MyMusicDataSet object in the DataSet Designer. The Edit Relation Dialog With the typed DataSet configured, create a new form, frmBrowser. You'll make it inherit from the rounded base class form ( frmRound) by showing all files in the Solution Explorer and editing the frmBrowser.Designer.vb file by hand. Unlike previous versions, the Windows Forms designer in Visual Basic Express (and the other versions of Express and Visual Studio 2005) puts all the designer-generated code in a partial class file. Partial classes are a new feature supported by the.NET Framework compilers that allow a single class to be partitioned between multiple source files.

The primary class file is defined just as before with a modifier and Class keyword. Partial classes are defined in any number of secondary source files by using the new Partial keyword in Visual Basic as part of the class definition between the visibility modifier and the Class keyword. To set up the data binding for the form, open the new Data Sources window. The Data Sources window was auto-populated with entities representing the data-returning objects from the project's typed DataSet.

Figure 17 displays the Data Sources window. The Data Sources window There are six items in the Data Sources windows. Three of the items represent the resultset returning stored procedures. Dragging the GetAllArtists object to the design surface creates sets up the data binding by adding a number of components and controls. Figure 18 displays a test form after the GetAllArtists data source was dragged on to the form's design surface.

A test form bound to a stored procedure with automatic data binding. The drag and drop process ads three components: a DataSet, DataConnector, and a TableAdapter.

It also adds, by default, a DataGridView control to display the data. In addition, there's a new hybrid component/control called the DataNavigator.

This item has an object on the component try as well as a UI portion. Its whole purpose is to provide a standard implementation for navigation of a data source. The DataSet object is pretty self-explanatory. It's the form's runtime instance for accessing data in the database. The DataConnector component is all about making the process of binding controls to an underlying data source easier.

The DataConnector component is the binding object between the data source and the controls that need binding. The TableAdapter is a typed version of the DataAdapter classes used in previous versions of the.NET Framework. It exposes typed methods for accessing data instead of directly exposing the underlying command objects.

With the Artist information bound, next set up a master-detail relationship between Artists and Recordings. To do this, select the Artists DataGridView control's Smart Tag (see Figure 19) to execute the Configure Master Details command. This command opens a dialog (see Figure 20) the lets you set up the parent-child relationship between two UI elements. In this case you add a second grid to the form. Now when you select an artist, the correct recording records are displayed. Repeat the process, binding the tracks to the recordings.

You'll need to add fill commands to the Form's Load event (one for each TableAdapter). A DataGridView controls Smart Tag displayed. The Add Related Databound UI dialog While the UI is nice, for this application it doesn't quite fit. Clicking a data source in the Data Sources window provides a drop-down to change the default UI control provided when a drag-and-drop gesture is used.

In this build of our application, the only two options are a grid or a set of labels and text boxes. Future builds will support other list controls such as List Boxes and even other custom controls. To remedy the solution in this build, simply add three list box controls and adjust the DataSource and DisplayMember properties appopriately based upon the way the grids are setup. Then delete the three grids and the DataNavigtor control, adjust the form, and the results are shown in Figure 21.

The completed Browse for Music form displaying data from the database. The last thing to do is to provide a way add tracks to the Play List on the main from. At this point I realized I might want a way to save play lists to the database also. Since I was using SQL Express, I knew I could take advantage of the new XML datatype. So, proceed to create a PlayLists table in the database with the following information: Table 4. PlayLists Table. ALTER PROCEDURE dbo.AddPlayList @PlayListTitle varchar(50), @PlayList xml AS DECLARE @PLCount int SELECT @PLCount = Count(PlayListTitle) FROM PlayLists WHERE PlayListTitle = @PlayListTitle IF @PLCount 0 BEGIN UPDATE PlayLists SET PlayList = @PlayList WHERE PlayListTitle = @PlayListTitle END ELSE BEGIN INSERT INTO PlayLists (PlayListTitle, PlayList) VALUES (@PlayListTitle, @PlayList) END RETURN The stored procedures parameters are set, with the XML for the PlayList parameter being provided via the PlayList instance's GetXML method.

If the update was sucessful, then the Play List header is updated with the name of the play list. Wrapping It Up Creating even a simple application can be quite a bit of work. However using SQL Express and Visual Basic Express you can cut hours of work off of the task. Is this application complete? But remember, shipping is a feature. Hopefully in a later beta, I can revisit the application and some features. Further Reading Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design, Second Edition by Michael J.

Dreamspark

Addison-Wesley Pub Co, 2003; ISBN The Relational Model for Database Management: Version 2 by E. Addison Wesley Publishing Company, 1990. ISBN The Database Relational Model: A Retrospective Review and Analysis: A Historical Account and Assessment of E.

Visual Basic 2010 Download

Codd's Contribution to the Field of Database Technology by C. Addison Wesley Longman, 2000.

Visual Basic 2010 Express Offline Music Apps For Computer

ISBN An Introduction to Database Systems, Eighth Edition by C. Addison Wesley Publishing Company, 8th edition 2003.