473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

music finder

i had to create a program for a programming class final, it breaks dow like this. i have 2 textboxes for user input, a drivelistbox which is linked to a dirlistbox which is also linked to a filelistbox so the user can choose the drive his music is on then find the folder the music is in and if others are like me you have so much music it takes for ever to find the artist or song you are looking for so i made a button that searchs the filelistbox for files that contain the strings input above in the textboxes and puts the results into a listbox on the far right. now the problem i am running into is i have put a media player control on the form so that when the user clicks the song he/she wants to listen to it will play in the media player control, the file in the listbox apparently does not have the path for the file so the media player will not play the selected file if someone could please help me out with the coding to allow the media player to trace the filepath so that the file playes i would be very very greatful.
Mar 5 '08 #1
11 2143
VBWheaties
145 100+
i had to create a program for a programming class final, it breaks dow like this. i have 2 textboxes for user input, a drivelistbox which is linked to a dirlistbox which is also linked to a filelistbox so the user can choose the drive his music is on then find the folder the music is in and if others are like me you have so much music it takes for ever to find the artist or song you are looking for so i made a button that searchs the filelistbox for files that contain the strings input above in the textboxes and puts the results into a listbox on the far right. now the problem i am running into is i have put a media player control on the form so that when the user clicks the song he/she wants to listen to it will play in the media player control, the file in the listbox apparently does not have the path for the file so the media player will not play the selected file if someone could please help me out with the coding to allow the media player to trace the filepath so that the file playes i would be very very greatful.
You want to combine the FileListBox text with the FileListBox.Path property to get the full path to the file:

Expand|Select|Wrap|Line Numbers
  1.    Dim sPath As String 
  2.    sPath = FileListBox1.Path & "\" & FileListBox1
  3.  
Mar 5 '08 #2
You want to combine the FileListBox text with the FileListBox.Path property to get the full path to the file:

Expand|Select|Wrap|Line Numbers
  1.    Dim sPath As String 
  2.    sPath = FileListBox1.Path & "\" & FileListBox1
  3.  
you are a life saver i have searched and search and came up empty. agian thank you for your help and wisdome....
Mar 6 '08 #3
now there is only one other thing i need to do with it and that is to make it go to the next song in the list. any ideas on how to do that???
Mar 10 '08 #4
VBWheaties
145 100+
now there is only one other thing i need to do with it and that is to make it go to the next song in the list. any ideas on how to do that???
Check out the EndOfStream event which might fire when the song completes.
Not being sure, I just looked at the controls events so experiment with the MANY events this control has.

To see the events, simply double-click the media player control in the designer and click the drop down at the top-right. You'll have to take it from there. Hope that helps.
Mar 10 '08 #5
i have tryed several different declaration for the media player and still nothing atm the listbox and media player private subs looks like this...


Private Sub lbResults_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbResults.SelectedIndexChanged
Dim path As String = Me.FileListBox1.Path & "\" & Me.lbResults.SelectedItem

AxWindowsMediaPlayer1.URL = path
AxWindowsMediaPlayer1.Ctlcontrols.play()

End Sub

Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsMediaEnded Then
If Me.lbResults.SelectedIndex < Me.lbResults.Items.Count - 1 Then
Me.lbResults.SelectedIndex = Me.lbResults.SelectedIndex + 1
Else
Me.lbResults.SelectedIndex = 0
End If
End If
End Sub

after this runs through it goes to the next song in the listbox and says opening media but nothing happens...
Mar 10 '08 #6
VBWheaties
145 100+
i have tryed several different declaration for the media player and still nothing atm the listbox and media player private subs looks like this...


Private Sub lbResults_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbResults.SelectedIndexChanged
Dim path As String = Me.FileListBox1.Path & "\" & Me.lbResults.SelectedItem

AxWindowsMediaPlayer1.URL = path
AxWindowsMediaPlayer1.Ctlcontrols.play()

End Sub

Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange
If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsMediaEnded Then
If Me.lbResults.SelectedIndex < Me.lbResults.Items.Count - 1 Then
Me.lbResults.SelectedIndex = Me.lbResults.SelectedIndex + 1
Else
Me.lbResults.SelectedIndex = 0
End If
End If
End Sub

after this runs through it goes to the next song in the listbox and says opening media but nothing happens...
Try this piece of code before setting the URL and before Controls.Play

Expand|Select|Wrap|Line Numbers
  1.    AxMediaPlayer1.AutoStart = False
  2.  
Another thing: try programming your completion check in EndOfStream event because the PlayStateChange event is called several times and I think you'll find bottlenecks since there are several change events fired (you can see this by putting Debug.Print "PlayStateChange event fired!" in the event).
Mar 10 '08 #7
with the controle i use "AxWindowsMediaPlayer1" the autostart option is not available.
Mar 10 '08 #8
VBWheaties
145 100+
with the controle i use "AxWindowsMediaPlayer1" the autostart option is not available.
Strange. What I would do is download the Windows Media Player SDK. With it you get documentation and probably some samples to work with.

http://msdn2.microsoft.com/en-us/lib...57(VS.85).aspx
Mar 11 '08 #9
ok i went and downloaded and installed windows media player 11 sdk and took a look at the information it provided and am now more confused than befor lol if you could give me some guidence on where to look withing the information that would be a great help. again i would like to thank you for all your help.
Mar 11 '08 #10
VBWheaties
145 100+
ok i went and downloaded and installed windows media player 11 sdk and took a look at the information it provided and am now more confused than befor lol if you could give me some guidence on where to look withing the information that would be a great help. again i would like to thank you for all your help.
Here is some documentation for interacting with the WMP control in Visual Studio:
http://msdn2.microsoft.com/en-us/lib...83(VS.85).aspx

Then, here is the google results with developers that have developed similarly:
http://www.google.com/search?hl=en&q...s+media+player
Mar 12 '08 #11
i thank you for your extensive help, i have looked over all the provided links and for some reasion i still cant figure out how to get it to load the next song in the listbox. it selects it and says loading media but never plays it, i tryed a do while loop but that didnt work any other ideas???
Mar 15 '08 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Marian Aldenhövel | last post by:
Hi, I am trying to make pygame play music on windows. This simple program: import pygame,time pygame.init() print "Mixer settings", pygame.mixer.get_init() print "Mixer channels",...
20
by: gallery | last post by:
Our client insists on having a music loop playing as the visitor travels throughout his new HTML website. We will not be doing this in frames and I would prefer not to have the home page spawn...
4
by: Wanhua Yi | last post by:
Hi all, anybody out there with experience in using EMC's Time Finder Software and DB2 UDB EEE on AIX ? Especially in using BCV for Backup ? Any white papers ?
2
by: Just Me | last post by:
If I use the shell32q.NameSpace(k) and the Parent property I can develop, for example, the path to My Music. Actually it ends with Desktop but Desktop can also be traced by using Parent to...
4
by: Doug van Vianen | last post by:
Hi, I am using Visual Basic 6 to generate web pages that can be used by the members of our seniors' computer club to create e-cards that include their own pictures. I wish to include background...
14
by: gnarl | last post by:
Hello all, I'm developing a site in PHP4 for a music artist, who wants music to play across all their pages. I have loaded a simple flash applet to play the music, but every time the visitor to...
2
by: FlashForumKB | last post by:
Here is a chance for you to make my developers look bad. I have hired these guys to development my website which, in part, has music demos available to my users. These demos must include the...
2
by: Suresh P | last post by:
Hi All, Is there any way other than frames to play music in the background of the website without restart while navigating to different pages of the website. Because, frames will affect the...
0
by: brahimbb17 | last post by:
There is no foolproof way to always win when gambling http://crop-finder-for-travian.blogspot.com . That is why it’s called gambling, you take risks and reap the benefits when lady lucks sides by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.