I have a program that has two forms. The first form is just a listview and a series of buttons making a keyboard.
The second form displays the selected item details from the first form.
The relevant code for the first form is :
My problem is that the code works well the first time round, shown by the msgboxes added to see what's being transferred.
But when another personID is chosen the PersonID in the frmMain shows the correct value but fails to transfer and the message
box in the frmPersonData sub shows PersonID =
Any ideas why this is happening.
Thanks.
The second form displays the selected item details from the first form.
The relevant code for the first form is :
Public Class frmMain Public PersonID As String Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load . . End Sub Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged PersonID = ListView1.SelectedItems.Item(0).SubItems(0).Text MsgBox("PersonID = " & PersonID) Me.Hide() frmPersonData.ShowDialog() End Sub and for the second form is : Private Sub frmPersonData_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim myDataSet As New DataSet() Dim constring As String Dim conn As SqlConnection Dim PersonID1 As String PersonID1 = frmMain.PersonID MsgBox("PersonID1 = " & PersonID1) . . End Sub Private Sub btnReturn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReturn.Click Dim frm As New frmMain Me.Close() frmMain.Close() ' Closes the Form 'THEN! Reload it. frm = New frmMain frm.Show() 'Shows a new,reloaded "frmMain" End Sub
My problem is that the code works well the first time round, shown by the msgboxes added to see what's being transferred.
But when another personID is chosen the PersonID in the frmMain shows the correct value but fails to transfer and the message
box in the frmPersonData sub shows PersonID =
Any ideas why this is happening.
Thanks.