Originariamente inviato da Multivelox


Nel mio Programma ho una ListBox tipo questa.. dove ci sono 7 voci... come faccio a far si che ogni voce mi faccia entrare in un form diverso?
Ad esempio nell' immagine di sopra:
GIOCO 1 apre un form (es. form3) GIOCO 2 apre un altro ancora (es.form4).... naturalmente i form devono uscire solo se ci si clicca sulla voce selezionata... mi dite che codice usare, o se non avete tempo anche una guida che dica come risolvere..
grazie !

vb 2005

Ti lascio un esempio che ho fatto spero ti sia d'aiuto

codice:
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For i As Integer = 1 To 5
            ListBox1.Items.Add("Gioco " & i)
        Next
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

    End Sub

    Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged
        Dim form3 As New System.Windows.Forms.Form

        form3.Text = ListBox1.Items(ListBox1.SelectedIndex).ToString
        form3.ShowDialog()

    End Sub
End Class