Torna al Thread

Public Class FormChiamante Inherits Form Private Sub ButtonChiama_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonChiama.Click 'Imposta il Tag della form chiamata sulla form Chiamante 'In modo che la form chiamata sappia su che Form deve 'Impostare i dati Dim formChiamata As New FormChiamata() formChiamata.Tag = Me 'Mostra la form formChiamata.Show() ''oppure 'formChiamata.ShowDialog() End Sub Public Sub SetData(ByVal nome As String, ByVal cognome As String, ByVal luogo As String, ByVal dataNascita As String) 'Imposta i valori delle textbox Me.TextBoxNome.Text = nome Me.TextBoxCognome.Text = cognome Me.TextBoxLuogo.Text = luogo Me.TextBoxDataNascita.Text = dataNascita End Sub End Class Public Class FormChiamata Inherits Form Private Sub ButtnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOk.Click 'All'evento click imposta i dati della form chiamante Dim chiamante As FormChiamante = Me.Tag 'L'oggetto selezionato nella listview Dim item As ListViewItem = ListView1.SelectedItems(0) 'Imposta i dati dall'oggetto delezionato 'Presuppone che le colonne siano nome, cognome, luogo e data nell'ordine chiamante.SetData(item.Text, item.SubItems(1).Text, item.SubItems(2).Text, item.SubItems(3).Text) 'Nasconde la form Me.Visible = False ''Se devi chiuderla usa 'Me.Close() End Sub End Class
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5