Select Case nbaléatoire Case 1 My.Computer.Audio.Play(My.Resources.Jean1.wav), AudioPlayMode.Background) 'adapter la resource Case 2 My.Computer.Audio.Play(My.Resources.Jean2.wav), AudioPlayMode.Background)'adapter la resource Case 3 My.Computer.Audio.Play(My.Resources.Jean3.wav), AudioPlayMode.Background)'adapter la resource End Select
My.Computer.Audio.Play(Application.StartupPath & "\Jean1.wav", AudioPlayMode.Background) 'joue en arrière plan
My.Computer.Audio.Play(My.Resources.Jean1.wav), AudioPlayMode.Background) 'adapter la resource
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nbraleatoire As Integer = 0
nbraleatoire = TextBox1.Text 'Remplace TextBox1.Text par le nombre aléatoire généré par ton code
Dim Son As System.Media.SoundPlayer
If nbraleatoire = 1 Then
Son = New System.Media.SoundPlayer(My.Resources.Jean1)
ElseIf nbraleatoire = 2 Then
Son = New System.Media.SoundPlayer(My.Resources.Jean2)
ElseIf nbraleatoire = 3 Then
Son = New System.Media.SoundPlayer(My.Resources.Jean3)
End If
Son.Play()
End Sub
Dim mesRessources As ResourceManager = My.Resources.ResourceManager Dim maRessource As Object = mesRessources.GetObject("Image1")