Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Access a file from a link stored in the database in visual basic application

Thread Tools Display Modes
Old 04-26-2012, 08:01 AM
user23 user23 is offline
Join Date: Apr 2012
Posts: 1
Smile Access a file from a link stored in the database in visual basic application

I am making a media player application using Visual Basic. Until now I have made a listbox in my application which shows the media library. I am using MS Access database for library.

Now my listbox is showing all the songs from the database field but i cant play the song from it. Can anyone give a method so that following objectives are completed -:

1) Database has all the "links" to the files in the user hard drive.
2) The user should be able play the song from the listbox by double clicking the songname in the listbox.

Now i want user to be able to open the mp3 file from the mediaplayer plugin
Reply With Quote
Old 04-26-2012, 09:22 AM
Gruff's Avatar
Gruff Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
Join Date: Aug 2003
Location: Oregon, USA
Posts: 6,440

I am somewhat out of my depth here as I have had zero interest in playing media from my apps, However...

If you double click one of your mp3 files manually does the correct player load?

If so then you could use the Shell() command or the API Execute command to launch your program with the selected file path and name.
Note: Any path or filename that contains a space must be bracketed by the double quote character.

Shell Execute Example:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Const SW_SHOWNORMAL = 1 Private Sub Button1_Click() Dim sFile as string sFile = "C:\Documents and Settings\My Documents\My Music\Cool Tunes.mpg" sFile = Chr(34) & sFile & Chr(34) ShellExecute Me.hwnd, vbNullString, sFile, vbNullString, "C:\", SW_SHOWNORMAL End Sub

If your "Addin" is for your IE browser you might look into the WebBrowser Control.
Burn the land and boil the sea
You can't take the sky from me


Last edited by Gruff; 04-26-2012 at 09:48 AM.
Reply With Quote

access 2010, media player, visual studio 2010

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..