473,769 Members | 5,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing dataset value to 2 forms

Hello,
Here is my scenario. I have a MDIForm, and 2 Child forms (ChildForm1 and
ChildForm2). The child forms can only be opened by their own toolbar icon on
the MDIForm. When I open ChildForm1, I have a datagrid that I may want to
search for a specific record from time to time. When I want to search for a
record, I click on the toolbar for ChildForm2 which basically gives me a
textbox for input. Once I click the OK button on ChildForm2, I want to close
that down, and move to the particular record in the grid that has that
information.
Now, my MDIForm is being referenced in the constructor of ChildForm2
already, but this is where I get confused. There are a lot of examples out
there for my problem, IF I had accessed ChildForm2 from ChildForm1. But
since I am opening ChildForm2 from the MDIForm, I don't know what to do.
What I want to do is run the search code directly from ChildForm2 after
the OK button on ChildForm2 has been clicked, and then close the form, and
move to that record on the grid in ChildForm1. So, I'm guessing what I need
to do is pass the dataset (or access it in any way) from ChildForm1 to
ChildForm2 so I can do the search, then move back to ChildForm1. Sorry about
any confusion, and thank you in advance.

Steve
Nov 20 '05 #1
2 1142
Hi Steve,

Based on my understanding, you have MDIForm and two child forms.(CF1,CF2)
On MDIForm there is two buttons ,each button will open a child form.
1. Where and when you will instance the child form, i.e. when you will "New
the two child forms"
with the code similar with below.
Dim fc1 As New cf1
fc1.MdiParent = Me' Me here is the MDI form
Dim fc2 As New cf2
fc2.MdiParent = Me

2. If when you open the CF2, the CF1 has already been opened, since you
hold the reference to MDI form, then by using the MdiChildren property of
MDI form, you can also get a reference to the ChildForm2(CF2) from
ChildForm1(CF1) .
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #2
Perfect. Thanks Peter!!

"Peter Huang" <v-******@online.m icrosoft.com> wrote in message
news:wV******** ******@cpmsftng xa06.phx.gbl...
Hi Steve,

Based on my understanding, you have MDIForm and two child forms.(CF1,CF2)
On MDIForm there is two buttons ,each button will open a child form.
1. Where and when you will instance the child form, i.e. when you will "New the two child forms"
with the code similar with below.
Dim fc1 As New cf1
fc1.MdiParent = Me' Me here is the MDI form
Dim fc2 As New cf2
fc2.MdiParent = Me

2. If when you open the CF2, the CF1 has already been opened, since you
hold the reference to MDI form, then by using the MdiChildren property of
MDI form, you can also get a reference to the ChildForm2(CF2) from
ChildForm1(CF1) .
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #3

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

Similar topics

8
3969
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer http://sourceforge.net/projects/cpp-perfometer http://alexvn.freeservers.com/s1/perfometer.html
3
13591
by: JJ | last post by:
Hi, I need to pass a dataset to another win form along with a SqldataAdapter. I don't want to recreate the SqlDataAdapter again either. So to pass to another Win form in my windows form app, do I create the procedure to pass by ref? Which means I don't need to add ByRef because it is defaulted by ref, correct? And in the constructor of the win form that gets created. I need to add in parameters a DataSet and SqlDataAdapter correct? What...
8
4415
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and click a button to determine whether the zip code is unique. If the zip code is not unique, another form/dialog is displayed (fclsLookup) - lookup form/dialog. The zip code is passed to the lookup form/dialog by reference. I then load a...
19
2532
by: Jaime Stuardo | last post by:
Hi all.. I have created a business logic component that is used from my ASP.NET webform. It works, but connection string to the database is hard coded, as in this method : public DataSet GetCategories() { SqlConnection conn = new SqlConnection("Data Source=DEVSERVER;Initial Catalog=XXXX;User ID=X;Password=Y");
0
1486
by: Eric Sabine | last post by:
OK, I'm trying to further my understanding of threading. The code below I wrote as kind of a primer to myself and maybe a template that I could use in the future. What I tried to do was pass data into a background thread and get other data out and also update the main thread on which the main form was created. It seems to work fine. The basic function of the app is cheesy, I didn't spend any time on exception handling. northwind.mdb...
5
1189
by: Darious Snell | last post by:
I am using windows forms and vb.net. My problem is a little complex so please bear with me. I have written an application that references a .com based API linked to an external client application. The API exposes client user interface objects. One of the objects is similar to a grid. The first part of my application creates a reference to the grid object in the client application.
0
1544
by: Iain McIntosh | last post by:
Hello if anyone can help me with this I will be very grateful. I have a working version of this program as a windows application, when I try to port it over to c# ASP.NET I can't make it work. The program works in the following way. Uploads a file to the server. (works) Populates a dataset (works) Passing the dataset to another class (doesn't work)
2
2596
by: Carl Heller | last post by:
Working in VS2003, .Net 1.1 I'm working on a project where I compare data between two databases. This is a lengthy process, and very data intensive, so I decided to create a class, and thread out the work. The order of work is as follows: 1. Retrieve the data from primary data source 2. Update UI with retrieved data - this is accomplished by passing a dataset as an event parameter
0
1544
by: Magnus Bergh | last post by:
I am developing an application for pocketpc and this involvs a but of juggling with different forms. I have an "order entry" type of application. On the main form I have a grid which displays Order headers. Let call this form "OrderList" From this view I edit/enter new orders by opening a new form for entering data. This is done using (more or less) the designer generated forms, so I have a "Order edit view dialog. I pass the binding...
4
5933
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh them I just set their datasource. I am guessing this is probably what is causing the problem. Is there a better way to do this? Anyway this all works happily and things show up when the record already exists but I have 2 problems ; 1) When I add...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
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...
0
9860
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...
0
8869
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
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
6668
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
5445
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3955
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
3
2814
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.