473,396 Members | 1,789 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.

How to return data from one form to another

Hi,

I have the main form, where from one of the methods, an instance
of another form is created. On the second form I have to fill some
data and be submitted by a button click. The data to be entered is to
be returned to the main form.

A sample of code of my problem.

// main Windows Form
private void EnterDataBtn_Click(object sender, System.EventArgs e)
{
SubForm x = new SubForm();
x.Show();
// here I need to get data that is filled on the sub form
// by doing "string = x.getData();", data entered is not being
// returned. Mainly because it not has been yet submitted
from
// other form.
// I need some sort of event or what?????
}

Please can someone help me out.

Thanks in Advance.
Nov 16 '05 #1
2 11022
Hi,

Declare some public properties in the second form from where you could get
your data back.
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,

I have the main form, where from one of the methods, an instance
of another form is created. On the second form I have to fill some
data and be submitted by a button click. The data to be entered is to
be returned to the main form.

A sample of code of my problem.

// main Windows Form
private void EnterDataBtn_Click(object sender, System.EventArgs e)
{
SubForm x = new SubForm();
x.Show();
// here I need to get data that is filled on the sub form
// by doing "string = x.getData();", data entered is not being
// returned. Mainly because it not has been yet submitted
from
// other form.
// I need some sort of event or what?????
}

Please can someone help me out.

Thanks in Advance.

Nov 16 '05 #2
Hi Xarky,

"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,

I have the main form, where from one of the methods, an instance
of another form is created. On the second form I have to fill some
data and be submitted by a button click. The data to be entered is to
be returned to the main form.

A sample of code of my problem.

// main Windows Form
private void EnterDataBtn_Click(object sender, System.EventArgs e)
{
SubForm x = new SubForm();
x.Show();
// here I need to get data that is filled on the sub form
// by doing "string = x.getData();", data entered is not being
// returned. Mainly because it not has been yet submitted
from
// other form.
// I need some sort of event or what?????
}

Please can someone help me out.

Thanks in Advance.


Besides what Ignacio said, you'll want to call Form.ShowDialog rather
than Form.Show. ShowDialog will not return (i.e. it will "wait") until the
form is closed.

Regards,
Daniel
Nov 16 '05 #3

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

Similar topics

8
by: Paul Bearden | last post by:
Greetings, I'm posting a form to a cgi application on another web site. The cgi returns a text message to the browser. How can I capture this text message and redirect based on the text. ...
3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
2
by: Ryan Mitchley | last post by:
Hi all I have the functions friend CComplexMatrixTemp eye(const size_t nN); and friend CComplexMatrixTemp & chol(CComplexMatrixTemp &z); I would like create expressions of the form...
3
by: RubiconXing | last post by:
Hi All Beginner question - please be patient with me :-) I am new to c#. If one creates a child modal (and also non-modal) form what is the best way of returning the collected data back to the...
2
by: David C. Barber | last post by:
upsized an MDB to ADP/SQL Server 2000 under Access 2000. All the DAO code that I've changed to ADO code is working fine, HOWEVER the form Record Source itself does not seem willing to return data....
2
by: baret bonden | last post by:
Trying to return a selected listbox item to another form .tried lots of ways; defining public variables and passing those as well as textboxes ..I' m able to display the chosen item on it's form...
2
by: lorirobn | last post by:
Hi, I have a continuous form which displays all the records on a table. The detail row has a command button which, if pressed, takes the user to another form where that record can be edited. ...
10
by: Raj | last post by:
I need a VB function to return array of collections like Private Type Employee empname as string address as string salary as integer deptno as integer End Type dim employees() as Employee
1
by: pfildes | last post by:
Hi, I am pretty new to VB.net and am having trouble figuring out how to do this. I have an app that copies data from one datasource to another. I have it set to run through a for loop for...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.