Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-02-2009
Member
 
Join Date: Jan 2009
Posts: 19
To access a text field from another form

Hello,
I am working with Visual Studio, dot net forms.
I have 2 forms Form X & Form Y.
I am opening Form Y on Form X using ShowDialog(). Now what I am looking for is a way to access a text field on Form Y(Called form) to Form X(Calling form).
Please help me in this situation.
Reply With Quote
  #2  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 115
Re: To access a text field from another form

Hi,
Can you tell us with some details what you exactly want to achieve?
Thanks,
Reply With Quote
  #3  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 40
Re: To access a text field from another form

For a ShowDialog form I mostly use simple "friend" fields in the showdialog
form, that gives me the most flexibility. this is not correct but I do this
only by one time to use ShowDialog forms.
Reply With Quote
  #4  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 63
Re: To access a text field from another form

Use the overload on ShowDialog() and pass in the calling form as the owner.
Now from the called form you can access a public member on the calling form.

Code:
Dim owner = TryCast(Owner, Form1)

If owner IsNot Nothing Then
'// Do something cool with the form
End If
I think this will help you!
Reply With Quote
  #5  
Old 06-02-2009
Member
 
Join Date: Jan 2009
Posts: 22
Re: To access a text field from another form

what you're
trying to do could be done for free by Access by setting up a query
containing the tables for both forms - they must be related, surely?
Reply With Quote
  #6  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 26
Re: To access a text field from another form

When you want to open the second form, from say a button click, use
code like this on the button in the first form:

DoCmd.OpenForm stDocName, acNormal, , , , , Me.boxFID

Where stDocName is the name of the second form and Me.boxFID is the
field that contains the value you want to pass.
The commas are all needed, they are for different options when opening
a form.

Then use code like this in the 'on open' event of the second form:

If Not IsNull(Me.OpenArgs) Then
Me.boxFinder.Value = Me.OpenArgs
Me.Requery
End If

Me.OpenArgs will be equal to whatever value you passed from the event
in the first form.
Reply With Quote
  #7  
Old 06-02-2009
Member
 
Join Date: May 2008
Posts: 44
Re: To access a text field from another form

Code:
form2.text1.text=text1.text
assuming that the command will be fired from the current form
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "To access a text field from another form"
Thread Thread Starter Forum Replies Last Post
count commas in a text field in Access SeaGuy Windows Software 4 07-09-2011 08:12 PM
Date field in HTML form Messenger Software Development 6 29-07-2010 10:30 AM
Switch the 'action' field in an HTML form MarceloQuad Software Development 4 07-02-2010 06:05 AM
Multi Field value field in Microsoft Access Erubiel Windows Software 3 20-11-2009 12:55 AM
Disable yellow autocomplete form field teenQ Technology & Internet 3 06-08-2009 09:57 PM


All times are GMT +5.5. The time now is 04:50 AM.