K
klesivp1
Как в массиве объекта (Button) добавить такое событие на каждый Button
на каждый Button своя мелодия при нажатии
на каждый Button своя мелодия при нажатии
Код:
Public Class Form1
Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Button() As Button = {Button1, Button2, Button3, Button4, Button5}
Dim Audio() = {"D:\Audio\1.wav", "D:\Audio\2.wav", "D:\Audio\3.wav", "D:\Audio\4.wav", "D:\Audio\5.wav"}
For i As Integer = 0 To fileLoad.Length - 1
Button(i).Text = (i)
Call mciExecute("play " & Audio(i))
Next
End Sub
End Class