Help transferring data between forms

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 2
Reputation: kajames is an unknown quantity at this point 
Solved Threads: 0
kajames kajames is offline Offline
Newbie Poster

Help transferring data between forms

 
0
  #1
Dec 11th, 2008
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:

  1. Public strName As String
  2.  
  3. Public DataForm As New frmData
  4.  
  5.  
  6. Private Sub lblContact_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblContact.SelectedIndexChanged
  7.  
  8. Me.lblContact.Text = strName
  9.  
  10. End Sub

On frmData:

  1.  
  2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
  3.  
  4. Dim AddressForm As New frmAddress
  5. AddressForm.strName= Me.txtName.Text
  6.  
  7. 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.
Last edited by kajames; Dec 11th, 2008 at 1:35 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 2,641
Reputation: Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light Jx_Man is a glorious beacon of light 
Solved Threads: 245
Jx_Man's Avatar
Jx_Man Jx_Man is offline Offline
Posting Maven

Re: Help transferring data between forms

 
0
  #2
Dec 12th, 2008
what errors came up?
try to use Shared variable to accomodate your address data.
Never tried = Never Know
So, Please do something before post your thread.
* PM Asking will be ignored *
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 2
Reputation: kajames is an unknown quantity at this point 
Solved Threads: 0
kajames kajames is offline Offline
Newbie Poster

Re: Help transferring data between forms

 
0
  #3
Dec 12th, 2008
There weren't any specific errors- but nothing happened.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 10
Reputation: NEo4 is an unknown quantity at this point 
Solved Threads: 0
NEo4 NEo4 is offline Offline
Newbie Poster

Re: Help transferring data between forms

 
0
  #4
Dec 14th, 2008
Try changing the code in frmAddress to:
  1. Public Shared strName As String
  2. Dim DataForm As New frmData
  3.  
  4.  
  5. Private Sub lblContact_SelectedIndexChanged _
  6. (ByVal sender As System.Object, _
  7. ByVal e As System.EventArgs) _
  8. Handles lblContact.SelectedIndexChanged
  9.  
  10. Me.lblContact.Text = strName
  11.  
  12. End Sub
and code for frmDate to:
  1. Private Sub Button1_Click(ByVal sender As System.Object, _
  2. ByVal e As System.EventArgs) _
  3. Handles btnAdd.Click
  4.  
  5. AddressForm.strName = Me.txtName.Text
  6.  
  7. End Sub
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC