Link to home
Start Free TrialLog in
Avatar of djdx2
djdx2

asked on

How do I send from text box to text box?

I have a text box named txtFname.text and txtLname.txt in two different forms.  I want to send the first txtFname.text which is in my FindCustomer.vb form to the txtFname.text on another form which is called SelectService.vb, how can I do this?  I need to do the same for txtLname.text field.
Avatar of djdx2
djdx2

ASKER

By the way I want this to happen when I click on a button named... btnGoToService
Declare txtFname on SelectService form as public, then you will be able to call SelectService.txtFName.Text = txtFname.Text from FindCustomer form


OR

in SelectService form create a property:

Public Property FName As String
        Set(ByVal Value As String)
            txtFName.Text = Value
        End Set
End Property

and assign text using that property
Avatar of djdx2

ASKER

I actually want to send it from a text box named txtFName1 to a label now named lblFName when the button is clicked....how about this?
Also, you will need a reference to the SelectService form somewhere.

In a module store a global variable like this:

Module Stuff
     Public _SelectService as Form
End Module

When you instantiate the form, set the reference variable to point to the form like this:

Dim f as New SelectService()
f.Show
_SelectService = f

Now you can talk to all of the public items on the form just like chaniewskim was saying:

_SelectService.FName  = "Test"

or

_SelectService.txtFName.Text
The text field of the label can be altered the same way as the textbox.
ASKER CERTIFIED SOLUTION
Avatar of chaniewskim
chaniewskim

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial