combo boxes and .mp3 music
Author |
Message |
molten_rock01
|
Posted: Sat Jun 11, 2005 11:56 am Post subject: combo boxes and .mp3 music |
|
|
Hi. I've got a problem with one of my forms. What I am trying to do is have a form which has several combo boxes, each containing about 4 songs of each genre. The problem is, when I select a song, the music does not play. I'm new to VB so could someone please explain to me what I should do? Thanks.
code: | Private Sub Form_Load()
Dim a As Integer
CmbRockandPop.AddItem ("Big Boat by M.Ward")
CmbRockandPop.AddItem ("This I Promise by The Naturals")
CmbRockandPop.AddItem ("Kathy Don't Do It by Steven W. Elliot")
CmbRockandPop.AddItem ("You by Doctor Rubber")
CmbEuropop.AddItem ("Under water by Skar Electronics")
CmbEuropop.AddItem ("Shine Down by Sunshine Reverb")
CmbEuropop.AddItem ("Spring will come by Alan Lauris")
CmbEuropop.AddItem ("In ther vortex by Oldiron")
CmbSoftRock.AddItem ("Take In by Aidan Hawken")
CmbSoftRock.AddItem ("One Familliar Game by Shira")
CmbSoftRock.AddItem ("Dejavu by Dejavu")
CmbSoftRock.AddItem ("Believe by Kevin Harrington")
CmbElectronicandDance.AddItem ("Chassie by Calamalka")
CmbElectronicandDance.AddItem ("Revolution by The Govenor")
CmbElectronicandDance.AddItem ("Alien by Apocalypse7")
CmbClassical.AddItem ("Hommage a Frank Zappa by Anthony Lanman")
CmbClassical.AddItem ("Adjuva Nos Deus by Coral de S. Domingos")
CmbClassical.AddItem ("Corant in F major from The Little Consort by Elisabeth Reed")
End Sub
Private Sub CmbRockandPop_Click()
Select Case CmbRockandPop.Text
Case "Big Boat by M.Ward"
a = 1
Case "This I Promise by The Naturals"
a = 2
Case "Kathy Don't Do It by Steven W. Elliot"
a = 3
Case "You by Doctor Rubber"
a = 4
End Select
If a = 1 Then
MMControl1.FileName = "C:\rockandpop1.mp3"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
kidz14
|
Posted: Thu Dec 15, 2005 7:21 pm Post subject: (No subject) |
|
|
if you have msn add me and i'll help you on there
t3chnicald3ath@hotmail.com |
|
|
|
|
|
kidz14
|
Posted: Thu Dec 15, 2005 7:46 pm Post subject: (No subject) |
|
|
you wud need more code like this worked for me, but then agin i use Microsoft Visual Studio 2005
code: | Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CmbRockandPop.Items.Add("Big Boat by M.Ward")
CmbRockandPop.Items.Add("This I Promise by The Naturals")
CmbRockandPop.Items.Add("Kathy Don't Do It by Steven W. Elliot")
CmbRockandPop.Items.Add("You by Doctor Rubber")
CmbEuropop.Items.Add("Under water by Skar Electronics")
CmbEuropop.Items.Add("Shine Down by Sunshine Reverb")
CmbEuropop.Items.Add("Spring will come by Alan Lauris")
CmbEuropop.Items.Add("In ther vortex by Oldiron")
CmbSoftRock.Items.Add("Take In by Aidan Hawken")
CmbSoftRock.Items.Add("One Familliar Game by Shira")
CmbSoftRock.Items.Add("Dejavu by Dejavu")
CmbSoftRock.Items.Add("Believe by Kevin Harrington")
CmbElectronicandDance.Items.Add("Chassie by Calamalka")
CmbElectronicandDance.Items.Add("Revolution by The Govenor")
CmbElectronicandDance.Items.Add("Alien by Apocalypse7")
CmbClassical.Items.Add("Hommage a Frank Zappa by Anthony Lanman")
CmbClassical.Items.Add("Adjuva Nos Deus by Coral de S. Domingos")
CmbClassical.Items.Add("Corant in F major from The Little Consort by Elisabeth Reed")
End Sub
Private Sub CmbRockandPop_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbRockandPop.SelectedIndexChanged
If CmbRockandPop.SelectedItem = "Big Boat by M.Ward" Then
MMControl1.FileName = "C:\Documents and Settings\Owner\Desktop\Xbox 360\1.mp3"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbRockandPop.SelectedItem = "This I Promise by The Naturals" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbRockandPop.SelectedItem = "Kathy Don't Do It by Steven W. Elliot" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbRockandPop.SelectedItem = "You by Doctor Rubber" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub
Private Sub CmbClassical_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbClassical.SelectedIndexChanged
If CmbClassical.SelectedItem = "Hommage a Frank Zappa by Anthony Lanman" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbClassical.SelectedItem = "Adjuva Nos Deus by Coral de S. Domingos" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbClassical.SelectedItem = "Corant in F major from The Little Consort by Elisabeth Reed" Then
MMControl1.FileName = "C:\Documents and Settings\Owner\Desktop\Xbox 360\2.mp3"
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub
Private Sub CmbSoftRock_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbSoftRock.SelectedIndexChanged
If CmbSoftRock.SelectedItem = "Take In by Aidan Hawken" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbSoftRock.SelectedItem = "One Familliar Game by Shira" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbSoftRock.SelectedItem = "Dejavu by Dejavu" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbSoftRock.SelectedItem = "Believe by Kevin Harrington" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub
Private Sub CmbEuropop_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbEuropop.SelectedIndexChanged
If CmbEuropop.SelectedItem = "Under water by Skar Electronics" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbEuropop.SelectedItem = "Shine Down by Sunshine Reverb" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbEuropop.SelectedItem = "Spring will come by Alan Lauris" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbEuropop.SelectedItem = "In ther vortex by Oldiron" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub
Private Sub CmbElectronicandDance_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmbElectronicandDance.SelectedIndexChanged
If CmbElectronicandDance.SelectedItem = "Chassie by Calamalka" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbElectronicandDance.SelectedItem = "Revolution by The Govenor" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
ElseIf CmbElectronicandDance.SelectedItem = "Alien by Apocalypse7" Then
MMControl1.FileName = ""
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End If
End Sub | [/code] |
|
|
|
|
|
kidz14
|
Posted: Thu Dec 15, 2005 7:49 pm Post subject: (No subject) |
|
|
the only problem i have with the Microsoft Multimedia Control 6.0 ( MCI32.OCX)
is that it won't stop one file when you go to slect the other and i don't wanna don the whole code but it's not that hard to stop it from playing the first then going to the second and of coarse in the code above you have to replace all the (MMControl1.FileName = "") with the location of the file |
|
|
|
|
|
|
|