473,396 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sharing Data Between Forms

I have two forms, the first has a textbox with customer name (read only) and a button to load the second form which has some textboxes for enter customer name, etc. When I populate these textboxes from SQL and click ok to close the second form I want the customer name from a textbox to return to the first form.

How do I do this? Return values? Global variables? Any help would be greatly appreciated!
May 21 '07 #1
8 1460
try using the hidden control, declare a html contol of type hidden, then set its value on the Form2 , when you reopen the form 1 you can get the value using Requets("hdnControlName");
May 21 '07 #2
TRScheel
638 Expert 512MB
try using the hidden control, declare a html contol of type hidden, then set its value on the Form2 , when you reopen the form 1 you can get the value using Requets("hdnControlName");
Or set a session variable... or cookie, though I would suggest session variables just because I am partial to them.


Session["FirstName"] = "HisName";
...
string FirstName = (string)Session["FirstName"];
May 21 '07 #3
Plater
7,872 Expert 4TB
Is this a web application or a windows application?

There is a sticky at the top of the forum the begs people to post correctly. Please read it as it sets a format for discussion titles.
May 21 '07 #4
Or set a session variable... or cookie, though I would suggest session variables just because I am partial to them.


Session["FirstName"] = "HisName";
...
string FirstName = (string)Session["FirstName"];
The suggestion is good, however please note creating a session or cookie require utilization of resource at client end, beside this making severe use of session variable is not a good practice.
In case if user wishes to create a session/cookie then please do abandon the session/delete the cookie once its use is over.
May 22 '07 #5
nmsreddi
366 256MB
Hello

If its a web application you can use java script to solve your

problem ,you can get the by gooling with key word as java script for popup i already send the some long time back for this you can easily search it ,dont try either cookies or sessions unless they are required mandatorly

Good Luck
May 22 '07 #6
Frinavale
9,735 Expert Mod 8TB
I have two forms, the first has a textbox with customer name (read only) and a button to load the second form which has some textboxes for enter customer name, etc. When I populate these textboxes from SQL and click ok to close the second form I want the customer name from a textbox to return to the first form.

How do I do this? Return values? Global variables? Any help would be greatly appreciated!

Please see this article on what Sessions are and how to use them
May 22 '07 #7
TRScheel
638 Expert 512MB
The suggestion is good, however please note creating a session or cookie require utilization of resource at client end, beside this making severe use of session variable is not a good practice.
In case if user wishes to create a session/cookie then please do abandon the session/delete the cookie once its use is over.

This is true, but it also takes some of the load off the server, which is why I am partial to them.

Good points though
May 22 '07 #8
Why don't you just create a class with friend shared variables and use them in the other form?
May 22 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Paul Schouten | last post by:
I was wondering if anyone could help me with this... I am having problems sharing data between child forms. the setup is as follows: mainFrm <--- MDIForm |----> ViewFrm <----ChildForm |---->...
6
by: varlagas | last post by:
We disabled the antivirus software but the problem persists. Any clues? Many thanks in advance! Panagiotis Varlagas ======================================================================= ...
2
by: Red Green | last post by:
I am trying to switch to C# from Delphi and I am having some trouble finding some information. What I need to do should be simple but I have been through a dozen books and done web searches that...
3
by: Robert W. | last post by:
I'm embarking on a project that will have both a desktop application and a Pocket PC application. It seems logical to have as much code as possible sitting in a shared project, which would be...
2
by: Mervin Williams | last post by:
I am using Infragistics UltraWebTab (a tab folder control for ASP.NET). My tab folder control will include five tab pages with a separate web form on each, and these web forms will share data. ...
1
by: Tod Birdsall, MCSD for .NET | last post by:
Hi All, I have two ASP.NET applications which I am trying to have share forms authentication. But I am running into problems. App A is an ASP.NET 2.0 Beta 2 application. App B is an ASP.NET...
3
by: Chris Thunell | last post by:
I have 2 forms, on 1 form i use the wizards to create a strong typed dataset with tables from an SQL database... and from that i can do stuff like: me.daEmployee.fill(me.dataset11.tblEmployee) ...
11
by: Nick | last post by:
Hello, Please pardon my ignorance as this is something I should know, but I'm a little unclear. I have an MDI based app. It is setup so the user opens a file and the main child form is created....
1
by: Bob Alston | last post by:
Having problems sharing an Access database on a Windows 2000 PC. The other PC is windows 98 (as I recall) but NOT windows 2000! The 2nd PC has a shortcut to the MDB on the primary PC. The MDB...
9
by: kirk | last post by:
I have program.cs, my "main" form and then a "settings" form. My "main" form existed for awhile and I had constants, instantiations, properties, etc within it created. I went to create my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.