carly 0 Newbie Poster

OK...here is the complicated stuff...

2 forms

form 1 plays an mp3 when the power button is switched on (default-power off)

form 2 is loaded when the scan button is selected from form 1

the scrollbar on the 2nd form automatically starts, here the scrollbar scrolls through numerous mp3s pausing for 3 seconds

when the select button is pressed, the mp3 track or "station" currently being played on the scrollbar should then become the mp3 that is played on the first form.

quite frankly...i have absolutely no idea whatsoever how to start this off never mind make this select button/event actually work!!

the next step after the select button is working would be for the currently played mp3 being played on the first form to be saved in an external text file when the power button is switched off...which is then to become the played track when power switched on again.

Hope somebody can make head from tail of all this.


Here is the code i have for the first form:

Private Sub btnPower_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPower.Click

If Mode = ModeEnum.OffMode Then

Mode = ModeEnum.OnMode

MediaPlayer1.URL = "c:\ChrisBrown.mp3"

Else

Mode = ModeEnum.OffMode

MediaPlayer1.Ctlcontrols.stop()


 

End If

SetMode(Me, Mode)

End Sub

 

Private Mode As ModeEnum = ModeEnum.OffMode

Enum ModeEnum

OnMode

OffMode

End Enum

Sub SetMode(ByVal ctl As Control, ByVal mode As ModeEnum)

Dim blnEnabled As Boolean = (mode = ModeEnum.OnMode)

For Each subCtl As Control In ctl.Controls

If Not subCtl.Name = "btnPower" Then

subCtl.Enabled = blnEnabled

End If

If subCtl.HasChildren Then SetMode(subCtl, mode)

Next

End Sub

 

 

Private Sub TckbarVolume_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TckbarVolume.Scroll

MediaPlayer1.settings.volume = TckbarVolume.Value * 10

End Sub

 

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

SetMode(Me, ModeEnum.OffMode)

Dim fileName As String = "C:\lastStation.txt"

Dim textLine As String = String.Empty

Try

If System.IO.File.Exists("C:\lastStation.txt") Then

Dim reader As New System.IO.StreamReader(fileName)

Do While reader.Peek() <> -1

textLine += reader.ReadLine()

textLine += Environment.NewLine()

Loop

Else

textLine = "File not found!"

End If

Catch Ex As Exception

textLine = Ex.Message

End Try

lblStationInfo.Text = textLine

End Sub

 

 

Private Sub btnScan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScan.Click

MediaPlayer1.settings.mute = True

Dim oForm As New Form2

oForm.ShowDialog()

MediaPlayer1.settings.mute = False

End Sub

 

Private Sub btnMute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMute.Click

If MediaPlayer1.settings.mute Then

MediaPlayer1.settings.mute = False

Else

MediaPlayer1.settings.mute = True

End If

End Sub

Private Sub radiobtnAM_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiobtnAM.CheckedChanged

 

 

If radiobtnAM.Checked Then

Module1.AM = True

Else

Module1.AM = False

End If

 

 

End Sub

 

 

Private Sub radiobtnFM_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radiobtnFM.CheckedChanged

 

 

If radiobtnFM.Checked Then

Module1.AM = False

Else

Module1.AM = True

End If

 

 

End Sub

 

End Class

And the second form:

Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click

Timer1.Enabled = False

MediaPlayer1.URL = ""

Me.Close()

End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 

Dim fileName As String = "C:\yourLocation.txt"

Dim textLine As String = String.Empty

Try

If System.IO.File.Exists("C:\yourLocation.txt") Then

Dim reader As New System.IO.StreamReader(fileName)

Do While reader.Peek() <> -1

textLine += reader.ReadLine()

textLine += Environment.NewLine()

Loop

Else

textLine = "File not found!"

End If

Catch Ex As Exception

textLine = Ex.Message

End Try

lblStationInfo.Text = textLine

End Sub

 

Private Sub scrollbarStations_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scrollbarStations.ValueChanged

Select Case scrollbarStations.Value

Case 1

If Module1.AM Then

lblStationInfo.Text = "First Radio 2345 MW"

MediaPlayer1.URL = "c:\Kylie.mp3"

Else

lblStationInfo.Text = "Testing Radio 2335 FM"

MediaPlayer1.URL = "c:\Robyn.mp3"

End If

Case 2

lblStationInfo.Text = "Second Radio 6654 MW"

MediaPlayer1.URL = "c:\Cascada.mp3"

Case 3

lblStationInfo.Text = "Third Radio 7563 MW"

MediaPlayer1.URL = "c:\Nickleback.mp3"

 

End Select

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

If scrollbarStations.Value < scrollbarStations.Maximum Then

scrollbarStations.Value = scrollbarStations.Value + 1

End If

End Sub

Private Sub radiobtnAM_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radiobtnAM.CheckedChanged

 

 

If radiobtnAM.Checked Then

Module1.AM = True

Else

Module1.AM = False

End If

 

 

End Sub

 

 

Private Sub radiobtnFM_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radiobtnFM.CheckedChanged

 

 

If radiobtnFM.Checked Then

Module1.AM = False

Else

Module1.AM = True

End If

 

 

End Sub

 

 

Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click

End Sub

End Class

I really hope someone can help me here because everytime i attempt this i muck up the entire project!!! :-(

Thanks

Carly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.