There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
audio avg avg 8 blue screen brand new codec control panel conversion crash delete personal data desktop display dos driver duplicate dvd error error message excel explorer file firefox game graphics hardware hijackthis log install installation internet itunes javascript laptop macro malware monitor msconfig msn music network outlook outlook 2003 outlook express php problem program random rundll32 security seo sound sp3 spyware switch tag cloud trojan usb video virtumonde virus vista visual basic vundo wallpaper windows windows vista windows xp wireless word xp sp3 youtube
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
VB Music


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Guitarstud2008's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Apr 2008
Experience: Advanced
07-May-2008, 07:44 PM #1
Exclamation VB Music
i am creating a game in visual basic and i know how to add music but i want to have a different song for the intro than the main game. how do i change the song in the code so that when a button is clicked the new song is then played on the music player?
DataBase's Avatar
Computer Specs
Senior Member with 270 posts.
 
Join Date: Jan 2004
Experience: Intermediate
08-May-2008, 09:07 AM #2
Well the click event of the button should STOP the intro song and load the new song. Iv done this before but havent the code on me at the moment, What i would do is create a sub that take a path ask the argument (which is the path of the song) and loads the song, then all you would do is something like this

Sub Intro()

LoadSong(app.path" & "\" & "IntroSong.wav")

End sub


Sub Command1_click()

StopSong()
LoadSong(app.path & "\" & "NewSong.wav")

End sub



Sub LoadSong(P as String)

MusicPlayer.play song P

end LoadSong


Sub EndSong()

MusicPlayer.Stop

End sub

obviously this isnt the real code just an example of how it could be done.
Guitarstud2008's Avatar
Computer Specs
Junior Member with 4 posts.
 
Join Date: Apr 2008
Experience: Advanced
08-May-2008, 05:04 PM #3
thank you very much ... i try it and see how it works
Reply

Tags
music, visual basic


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

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 On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:03 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.