Hi,
I created a bunch of buttons (named button1, button2 etc.). When the button is clicked it plays a sound file (sound1.mp3, sound2.mp3, etc.), using the Media player (mp).
Right now the coding looks like this:
So I have one Sub for every button.
I wondered if is was possible to simplify that for e.g. 100 buttons, creating a coding that automatically assigns buttonX to soundX.mp3
How do I do that?
Thank you very much in advance.
I created a bunch of buttons (named button1, button2 etc.). When the button is clicked it plays a sound file (sound1.mp3, sound2.mp3, etc.), using the Media player (mp).
Right now the coding looks like this:
Sub button1_Click
mp.Load(File.DirAssets, "sound01.mp3")
mp.Play
End Sub
Sub button2_Click
mp.Load(File.DirAssets, "sound02.mp3")
mp.Play
End Sub
Sub button3_Click
mp.Load(File.DirAssets, "sound03.mp3")
mp.Play
End Sub
So I have one Sub for every button.
I wondered if is was possible to simplify that for e.g. 100 buttons, creating a coding that automatically assigns buttonX to soundX.mp3
How do I do that?
Thank you very much in advance.