473,769 Members | 4,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass values back to called form

hi
i have doubt in how to pass values back to the called
form. I have two forms, each having a textbox and a button
control. First i'm run the first form and click the
button, it creates object for second form and showed as
modaless. And i entered some text in second form's
textbox. While i clicked the seconds form's button the
value in textbox of second form to be transfered to first
form textbox. Thanx
Nov 15 '05 #1
2 2038
Chane <an*******@disc ussions.microso ft.com> wrote:
i have doubt in how to pass values back to the called
form. I have two forms, each having a textbox and a button
control. First i'm run the first form and click the
button, it creates object for second form and showed as
modaless. And i entered some text in second form's
textbox. While i clicked the seconds form's button the
value in textbox of second form to be transfered to first
form textbox. Thanx


When you create the second form, make sure it knows about the first
form (pass it as a reference in the constructor, for instance) and give
some way in the first form of receiving the new value. Just think of
the forms as ordinary objects, and how you'd do this if the GUI wasn't
involved at all.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
There can be two ways

1. Pass the reference of form1 to the form2. Using that reference from
form2, access the text box (it should be public or if you want to keep it as
private then you would have to create a public property to access it) of
form1 and set the text there.

2. Create a pubilc property in form2 which will be set with the text when
you press that button. Since form1 has the reference to form2, use that
reference and access the public property of form2 and then set it in the
text field of form1.

I hope it helps..

"Chane" <an*******@disc ussions.microso ft.com> wrote in message
news:05******** *************** *****@phx.gbl.. .
hi
i have doubt in how to pass values back to the called
form. I have two forms, each having a textbox and a button
control. First i'm run the first form and click the
button, it creates object for second form and showed as
modaless. And i entered some text in second form's
textbox. While i clicked the seconds form's button the
value in textbox of second form to be transfered to first
form textbox. Thanx



Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1856
by: Tim | last post by:
Hi, I am trying to pass a SQL Command, complete with parameters and their values from one form to a modal form. The modal form has; public void GridDataPreload(System.Data.SqlClient.SqlCommand cmdPreload) { }
10
1269
by: Stephen Costanzo | last post by:
I basically am attempting to create a form with two checkboxes and want a 1, 2, or 3 to come back depending on the user choice to the calling form (like a message box, basically) I didn't know if there was a way to pass it back other than throwing an error (which isn't an error) or raising an event (which would set a value outside of the module procedure) Thanks
19
9082
by: nazgulero | last post by:
Hello all, I wonder if anybody can give me a hint about what I have to do to get this working: I am creating a drop down box using the script below. The result is two text fields; now I want to pass those values, which come from the drop down box, to the next page. The next page should then simply look like this:
6
5977
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few forms in the database that will use this function, so I need to be able to tell the code which form to unlock. What I have is as follows: Public Function akeyEdit()
14
20410
by: Abhi | last post by:
I wrote a function foo(int arr) and its prototype is declared as foo(int arr); I modify the values of the array in the function and the values are getting modified in the main array which is passed also. I understand that this way of passing the array is by value and if the prototype is declared as foo(int *), it is by reference in which case the value if modified in the function will get reflected in the main function as well. I dont...
14
3608
by: =?Utf-8?B?Umljaw==?= | last post by:
I have seen examples of passing data from FormB to FormA (Parent To Child) but I need an example of passind data from FormA to FormB. My main form is FormA; I will enter some data in textboxes and click a button to bring up FormB which needs to display values entered in FormA. Thanks in advance.
5
4236
by: Rob | last post by:
I have a control (Button) on a Parent form which opens a Windows form... all I want to do is pass a value from the child form back to the parent... it should be so simple... i.e. ParentFormName.Textbox1.text=ChildFormName.TextBoxWhatEver.Text... but nothing like this works. Any ideas ?
24
55232
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new EventHandler(Onbutton_click); I want to pass more information related that event. & want to use that
12
11109
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9849
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7393
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.