473,480 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

communcation between forms - give back data from form2 to parent-form1

hello,

i'm working in VB.NET (2005) and i've got the following problem:

i've got 2 forms. (formMain and formSeach). In formMain i've got a
function to open formSeach.

Dim frmSeach as new formSeach
frmSeach.ShowDialog()

in formSeach there is the possibility to seach for some data and, when
the users clicks on OK, formSeach will close and the data will be used
in formMain.

The problem is, i don't know how to get the data from formSeach into
FormSeach.

I thought about using pointers but VB.NET doesn't support pointers as
far as i know.

Question: Whats the best way to give data back from a form to the
parent form??

Jul 20 '07 #1
1 1378
On Jul 20, 3:22 am, "unknown;" <unknown1...@gmail.comwrote:
hello,

i'm working in VB.NET (2005) and i've got the following problem:

i've got 2 forms. (formMain and formSeach). In formMain i've got a
function to open formSeach.

Dim frmSeach as new formSeach
frmSeach.ShowDialog()

in formSeach there is the possibility to seach for some data and, when
the users clicks on OK, formSeach will close and the data will be used
in formMain.

The problem is, i don't know how to get the data from formSeach into
FormSeach.

I thought about using pointers but VB.NET doesn't support pointers as
far as i know.

Question: Whats the best way to give data back from a form to the
parent form??
I depends, are opening the second form modally or not?

If the second form is modal, the simplest way is to obtain the values
from the instance of the second form you created. In the second form
you need to simply expose the necessary fields via properties.

If it's not opened modally, the best (imo) way is to raise a custom
event from the second form. The process would go like this:

In Form1:

Instantiate Form2
Subscribe to Form2's event
When Form2 closes, retrieve value(s) from the ...EventArgs Argument
in the event handler

In Form2:

Raise your custom event when the user clicks OK.

If you need sample code on how to create the custom event, let me know
and I'll be happy to post it for you.

Thanks,

Seth Rowe

Jul 20 '07 #2

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

Similar topics

4
2065
by: Al Jones | last post by:
I have an application - an insurance form - which requests personal data on form one. If the user checks auto or homeowner (or both) on the first form I need to collect data from each of these...
3
314
by: Blacky | last post by:
Hi I'm trying to make a form that works like the form when you goto Tools -> Options in VS.NET. I have a ListView on the left hand side of form A with different items. When double clicking...
6
1451
by: AMeador | last post by:
I have a form where a user will check boxes next to items that have been completed. They will click a button on the form to mark the items as completed. When they do this, I will have the 'parent'...
5
329
by: Adriano | last post by:
hello, what is the property or event to check if the child form is alredy open? I just want to avoid opening a child form inside the parent form twice. thanks in advance
4
1694
by: Steven Thomas | last post by:
Ok, I am a newbee at vb.net and I have written an application with multiple forms. I have created a form named frmbase with all other forms are inherited from. frmbase has my menu on it. I have...
1
894
by: Martin Williams | last post by:
I'm developing a survey program. Currently, I have the parent form and the survey which consists of three forms. As the user moves from one "page" or form to the next, I would like to allow the...
4
1258
by: =?Utf-8?B?VGVycmFuY2U=?= | last post by:
I have a question about functionality I was wondering if anyone ever tried. Here is my problem/question. I'm currently in the motions of learning C# with that said I created a windows application...
14
3332
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
6
2233
by: RobcPettit | last post by:
Hi, Im using two forms in the same application. Main form opens, click menu for secend form. This is a log on form, used to get three bits of info. Up to this point Im ok. I then want to send this...
6
1914
by: raylopez99 | last post by:
This thread is about how variables or parameters (including objects) are passed between forms (namely, using parameterized constructors, e.g., to pass an int between forms (e.g., a calling form and...
0
7048
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
7050
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,...
1
6743
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
6966
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...
1
4787
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...
0
4488
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...
0
2999
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...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.