473,698 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing data child parent parent child

hi,
how can i pass data from a parrentform to a childform and reverse
or retreave data from a childform of the parentform and reverse.

Regards Maarten
Nov 20 '05 #1
3 3217
A form is generated from a class. So simply add public or internal
properties to the child form class to pass data to it from the parent form.

Simply instantiate the child form class, set the properties, and then show
the form.

Pete
"Maarten" <gu******@hotma il.com> wrote in message
news:43******** *************** @news.skynet.be ...
hi,
how can i pass data from a parrentform to a childform and reverse
or retreave data from a childform of the parentform and reverse.

Regards Maarten

Nov 20 '05 #2
Dearest Maarten,
how can i pass data from a parrentform to a childform and reverse
or retreave data from a childform of the parentform and reverse.


Passing down variables to child forms or retrieving data from them is
very easy. While you're creating a new form, you're allowed to set a
different constructor - i.e. you can specify your own variables in the
form's constructor. This should allow you to pass down variables to
your child form while you're creating it.

To retrieve data from a parent form, simply declare a public variable
in the Parent form, and access it from the child form.

Heh, simple.

Nov 20 '05 #3
Thank's for the answers, they where not what i expected, but helped me much
more
than i expected.
i'm beginning to have a clear view on object orientated programmaing.

now i'm facing an other problem.
here is my code:

on a parrentform:

using UCAnalog;

namespace frmsettings
{
public class settings : System.Windows. Forms.Form
{
private void button2_Click(o bject sender, System.EventArg s e)

{

Analog an = new Analog();

an.listsetup();

this.Close();

}

}

}

on a usecontrol ;
namespace UCAnalog

{

public class Analog: System.Windows. Forms.UserContr ol

{

public void listsetup()

{

MessageBox.Show (test");

lstout.Items.Ad d ("Channel ",false);

}

}

}

I know the function listsetup in the class analog is called because the
messagebox gets activated.
but the item won't add in the checkedlistbox.

hope someone can help me.

greets Maarten.

"Maarten" <gu******@hotma il.com> wrote in message
news:43******** *************** @news.skynet.be ...
hi,
how can i pass data from a parrentform to a childform and reverse
or retreave data from a childform of the parentform and reverse.

Regards Maarten

Nov 21 '05 #4

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

Similar topics

11
6857
by: Mike M | last post by:
Is it possible? In the parent process, I have a socket that binds, listens and then accepts new connections (which creates new sockets in the process). I want to be able to pass some of these new sockets to a spawned process. Is it possible, and if so how? Any help is much appreciated!! Mike
4
13084
by: John MacIntyre | last post by:
Hi, I have a page with a series of child pages loaded into an iframe. When I move from page to page, I store an object containing the child's control data in a variable on the main page, then use that data to populate the controls when the child page is opened again. One of these objects contains an Array, and the page reloads fine using myArray, myArray, etc... But when I try perform some array methods on it (i.e.slice) ... it does...
1
2418
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML GENERATED BY FUNCTION. Here'e the point: I'm writing a simple website for showing my photographs. It has a central page with many links (as many as galleries are).
2
2722
by: Curtis Justus | last post by:
Hi, I currently have a control that is on a form and I want to pass that exact instance of the control to another form (a child form that appears on a button click). The control has state, etc. that works with both forms. In my button click on FormA, I take my control and pass it to a constructor in FormB. Here is the code in the constructor:
1
317
by: mark | last post by:
I have a main form, and i have another form i need to call on a button press, then id like the result of the child form to pass data back to the parent - without losing any data previously entered on the parent - is this possible ? ( my main parent window is starting to get quite cluttered) cheers mark
5
1301
by: Stephen Travis | last post by:
I'm trying to ReDim a child object after passing the parent object as System.Object and it throws a System.InvalidCastException: Cast from type 'Object()' to type 'ChildType()' is not valid. If I pass the parent object as its type, the ReDim succeeds. How can I ReDim a child object from a parent object passed as System.Object? Here's the problem... Private Sub Page_Load Dim NewParent As New ParentType addTwoChildrenSucceeds(NewParent)...
5
7735
by: Swinky | last post by:
I have a form "AccountInfo" that contains company names. I have inserted a subform "Contacts" with contact names and have established parent/child relationships between the two forms. All works well. I created an "Add New Contact" command button which passes the CompanyID (unique key set to autonumber) to the new record. This successfully works if the parent record (AccountInfo) has at least one existing contact. But if there are no...
9
4019
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New DataTable("SliceInfo") Dim tblSliceRatings As New DataTable("SliceRatings") '.... All the adding datacolumns, datarows, etc. goes here.. DatasetInit.Tables.Add(tblSliceInfo)
4
5923
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
8610
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
9170
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
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8902
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,...
1
6528
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
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
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.