Hi,

I'm currently working on a group project that involves an address book (working in VisualBasic.Net 2003). I have one form (frmData) in which the user enters data. I want to transfer it to a label on my other form (frmAddress). Currently, on frmAddress:

Public strName As String

Public DataForm As New frmData


Private Sub lblContact_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblContact.SelectedIndexChanged

        Me.lblContact.Text = strName

End Sub

On frmData:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Dim AddressForm As New frmAddress
        AddressForm.strName= Me.txtName.Text

    End Sub

If someone has a suggestion (I obviously have no idea what I'm doing and need lots of help), please reply. I'm very new at this.

what errors came up?
try to use Shared variable to accomodate your address data.

There weren't any specific errors- but nothing happened.

Try changing the code in frmAddress to:

Public Shared strName As String
    Dim DataForm As New frmData


    Private Sub lblContact_SelectedIndexChanged _
                    (ByVal sender As System.Object, _
                    ByVal e As System.EventArgs) _
                    Handles lblContact.SelectedIndexChanged

        Me.lblContact.Text = strName

    End Sub

and code for frmDate to:

Private Sub Button1_Click(ByVal sender As System.Object, _
                              ByVal e As System.EventArgs) _
                              Handles btnAdd.Click

        AddressForm.strName = Me.txtName.Text

    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.