13/02/11 21:45
fifiddu
ciao a tutti, sto iniziando a costruire un programmino dove far suonare alla pressione del pulsante play un file wave, il programma e composto da 3 pulsanti: play, stop, open ( apro il file con openfiledialog) 1 combobox: visualizzo il percorso del file, una label.text: visualizzo il nome del file, ora fin qui ci sono riuscito e funziona alla grande, ma se voglio duplicare la stessa applicazione sullo stesso form e quindi: 3 pulsanti di cui: play, stop, open etc... e vado a cambiare i rispettivi percorsi quindi il secondo pulsante di play con il secondo opefiledialog2 etc..e voglio far suonare ad ogni pulsante play un suono diverso, questi mi da errore e mi esce la seguente scritta:
System.ArgumentNullException was unhandled
Message="L'argomento non può essere Nothing. Nome parametro: location"
ParamName="location"
l'idea e di voler creare tanti pulsanti play da far corrispondere ad ogni pressione del medesimo pulsante un suono diverso. vi posto il codice da me scritto:
spero di essere stato chiaro di essere aiutato
allego file immagine del form.
System.ArgumentNullException was unhandled
Message="L'argomento non può essere Nothing. Nome parametro: location"
ParamName="location"
l'idea e di voler creare tanti pulsanti play da far corrispondere ad ogni pressione del medesimo pulsante un suono diverso. vi posto il codice da me scritto:
spero di essere stato chiaro di essere aiutato
allego file immagine del form.
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click My.Computer.Audio.Play(ComboBox1.Text) End Sub Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged End Sub Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk ComboBox1.Text = OpenFileDialog1.FileName End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click My.Computer.Audio.Stop() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click OpenFileDialog1.ShowDialog() Label1.Text = OpenFileDialog1.SafeFileName End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click My.Computer.Audio.Play(ComboBox2.Text) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click OpenFileDialog2.ShowDialog() Label2.Text = OpenFileDialog2.SafeFileName End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click My.Computer.Audio.Play(ComboBox3.Text) End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click OpenFileDialog3.ShowDialog() Label3.Text = OpenFileDialog3.SafeFileName End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click My.Computer.Audio.Stop() End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click My.Computer.Audio.Stop() End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click My.Computer.Audio.Stop() End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click My.Computer.Audio.Stop() End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click My.Computer.Audio.Play(ComboBox4.Text) End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click OpenFileDialog4.ShowDialog() Label4.Text = OpenFileDialog4.SafeFileName End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click My.Computer.Audio.Play(ComboBox5.Text) End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click OpenFileDialog5.ShowDialog() Label5.Text = OpenFileDialog5.SafeFileName End Sub End Class
Ultima modifica effettuata da Il Totem 14/02/11 10:21
aaa