2 Replies - 875 Views - Last Post: 25 November 2012 - 09:14 PM Rate Topic: -----

#1 TomPolar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 25-November 12

Playing Random Video/Music file within folder.

Posted 25 November 2012 - 01:48 PM

Hi there do you know if it's possible to play a random video/music file within a folder which is familiar to the random number function. Currently at the moment I have it setup like this
 Public Class Form1
    Dim r As New Random
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        Dim RandomNumber As Integer = r.Next(0, 6)  'Generates Random Number between 0-6
        Select Case RandomNumber
            Case 0
                Process.Start("My File")





Is This A Good Question/Topic? 0
  • +

Replies To: Playing Random Video/Music file within folder.

#2 TomPolar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 25-November 12

Re: Playing Random Video/Music file within folder.

Posted 25 November 2012 - 02:04 PM

This wasn't meant to be posted -.-. If any one can delete this that would be great, unless of course I can delete it(but couldn't find how to)
Was This Post Helpful? 0
  • +
  • -

#3 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: Playing Random Video/Music file within folder.

Posted 25 November 2012 - 09:14 PM

View PostTomPolar, on 25 November 2012 - 02:48 PM, said:

Hi there do you know if it's possible to play a random video/music file within a folder which is familiar to the random number function. Currently at the moment I have it setup like this


Get the directory contents as strings, filter for file type, add the contents to an array or List(of T), then generate a random index between 0 and .Count-1, and do a Process.Start(ArrayName(index)).

You'll want to know when the the music stops playing, if you want to carry on with more songs. Check the other members of the Process class.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1