Good day,

I am creating an application that can play sounds on my program i used the snippet of VB.net

i am using this code to play some sounds
My.Computer.Audio.Play(".wav")

all i want is to random pictures and the sounds associated on that pictures will be played...

I ma having problem with the sounds..

would i used Dictionary or List..

any suggestions

thanks

use a listbox control and add paths of your sound files in it , then give index of listbox where you have to give path of your sound file ,

Regards

>>all i want is to random pictures and the sounds associated on that pictures will be played...
How do you plan to add the images and sounds to get recognized?
.From a File?.From My.Resources?.Full.Paths coded into your app.?

@codeorder maybe from a file...

once the application appear i want to randomize the images together with sound associated with it. let say the image is A the sound should be "A" also. if the image is cloud the sound should be "CLOUD"..

i am using this code..

My.Computer.Audio.Play(".wav")
just to play the audio of each images..


thanks

File.Content:

img1.png|sound1.wav
img2.png|sound2.wav
img3.png|sound3.wav
Imports System.IO
Public Class Form1
    Public myMediaFolder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\TEMP\"
    Private myMediaListFile As String = myMediaFolder & "myMediaList.txt"
    Private arMedia() As String, iTemp As Integer, rnd As New Random, chrMain As String = "|"

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If File.Exists(myMediaListFile) Then arMedia = File.ReadAllLines(myMediaListFile) '// load file.
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Not arMedia.Length = 0 Then
            iTemp = rnd.Next(0, arMedia.Length) '// get random #.
            With arMedia(iTemp)
                MsgBox(.Split(chrMain).GetValue(0) & vbNewLine & _
                       .Split(chrMain).GetValue(1))
            End With
        End If
    End Sub
End Class

Hope this helps.:)

@codeorder thanks it helps me alot..

once again my friend thank you.. GOD Bless. You save my day

This question has already been answered. Start a new discussion instead.