VB.net loop mp3 until next IF is selected
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: VB.net loop mp3 until next IF is selected

  1. #1
    Join Date
    Aug 2008
    Posts
    82

    Question VB.net loop mp3 until next IF is selected

    Hey all i have the following code:
    Code:
    Dim totalDistance as Boolean = False
    
    Private Sub distanceCheckerTicker()
            Dim totalDistance As Integer = 0 'MAX 1,000
    
            For Each pair As KeyValuePair(Of String, Integer) In mainMenu.backupSensorData
                totalDistance += pair.Value
                'If (pair.Key = "A") Then totalDistance += pair.Value
                'If (pair.Key = "B") Then totalDistance += pair.Value
                'If (pair.Key = "C") Then totalDistance += pair.Value
                'If (pair.Key = "D") Then totalDistance += pair.Value
            Next
    
            If totalDistance <= 210 Then
                'red
                If isPlaying = False Then
                    isPlaying = True
                    WMP.URL = Application.StartupPath + "\red.mp3"
                    WMP.controls.stop()
                    WMP.controls.play()
                    WMP.settings.setMode("loop", True)
                End If
    
                backupLineRED.Visible = True
                backupLineYELLOW.Visible = False
                backupLineGREEN.Visible = False
            ElseIf totalDistance > 210 And totalDistance <= 670 Then
                'yellow
                WMP.URL = Application.StartupPath + "\yellow.mp3"
                WMP.controls.play()
                backupLineRED.Visible = True
                backupLineYELLOW.Visible = True
                backupLineGREEN.Visible = False
            ElseIf totalDistance > 671 And totalDistance <= 1000 Then
                'green
                WMP.URL = Application.StartupPath + "\green.mp3"
                WMP.controls.play()
                backupLineRED.Visible = True
                backupLineYELLOW.Visible = True
                backupLineGREEN.Visible = True
            End If
    
            Debug.Print(totalDistance)
        End Sub
    I am wanting to loop the sound until it reaches the next IF statement. However i cant think of a way to check for it correctly because isPlaying would always stay true and i need to find a way to set it back to false when it goes into another IF statement.

    Any help would be great! Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: VB.net loop mp3 until next IF is selected

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Aug 2008
    Posts
    82

    Re: VB.net loop mp3 until next IF is selected

    Doesnt have anything to do with sounds it seems...

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: VB.net loop mp3 until next IF is selected

    ask around there for a general answer
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center