.net - Parent/Child Relationships Failing When Getting Data From Parent Class With Multiple Forms Open?

Jun 24, 2009

I have a main form, and some sub forms, and each sub form can have some sub forms. When I have multiple sub forms open, and I try to get data from the parent form, it returns the data from the wrong parent form.For example I have two instances of Mainform.subform running. If I do something like this in a child form of one instance of the subform. It returns data from the other subform.

dim l = Mainform.subform.listofdata

Edit:I am using visual Studio 2008. Winforms, form designed using designer. In my mainform I am doing this

Protected Friend frmMain as Mainform
frmmain = new mainform

In frmMain I am doing this

Protected Friend frmsub as new Subform'
frmsub = new subform

[code]....

View 1 Replies


ADVERTISEMENT

Parent-child Relationships Of Controls In 2005 Express

Jan 10, 2009

In VB6, if you put a picturebox on a form and then put a control inside the picturebox, then the control would be a child of the picturebox. Its location would be relative to the picturebox and not the form.If you do the same thing in VB 2005 Express , the control seems to still be a child of the form and not the picturebox (i.e. its location property is relative to the form).Is there any way to make a control or graphic inside a picturebox a child of the picturebox and not the form?

View 2 Replies

Forms :: Set Property Of Parent Class From Child

May 14, 2009

I would like to have a form class that is called from a button on a parent form and would like a button on the child form to set a property on the parent form. Can anyone explain the best way to go about this or direct me to a good article?

[Code]...

View 3 Replies

Forms :: Disable Parent Window While Child Is Open?

Dec 6, 2009

how to disable parent window while child is open so the user cannot click any object in the parent window and to Force the user to interactive only with the child

View 2 Replies

Sql - Inserting Multiple Parent Rows And Multiple Child Rows For Each Parent With ADO.NET In One Setting

Nov 28, 2011

I am looking for a howto or someone expert in ADO.NET who can explain me how to properly solve the following scenario:I have two datatables in a dataset:

ParentTable (ParentID, Name) for user data ChildTable (ParentID, ActivityID, ...) for schedule data

Tables are linked together at the database level by ParentID which is an Identity column in ParentTable.

Both tables are data bound to a separate DataGridView on the GUI. There supposed to be a "1 parent/N children" relationship between the tables, meaning if I create a new entry in the ParentTable (a new user) I get a clean DataGrid in the child grid to type schedule data for the user. So I setup two DataAdapters for each table to fill their result into a DataSet. I also set up a DataRelation object and assign it to the DataSet to link the two tables by their ParentID columns. Also when I add a row into the ChildTable via DataGrid I use SetParentRow to set the parent row.

[Code]...

View 1 Replies

Releasing A Child From A Parent Control Without Knowing The Parent(WPF)

Apr 10, 2010

I would like to know if there is some simple code to release a child control from it's parent control, without having to name the parent control. In pseudocode, I'm looking for something like this:

[Code]...

View 2 Replies

MDI Parent And MDI Child Forms?

Feb 11, 2010

I'm just getting started in VBE 2008 porting a VB6 program and have created the MDI Parent form. I've added a form called frmNav and need to designate this and all subsequent forms as MDI child forms. Is there somewhere in each form's properties where I designate this? It used to be in VB6 there was a property called "MDIChild = True." input id="gwProxy" type="hidden"><!-- Session data--></input> <input id="jsProxy" onclick="jsCall();" type="hidden" />

View 1 Replies

Get A Value Inside Parent Class From Child Class (in Nested Classes)?

Jan 1, 2012

I have Class1 and class2 which is inside class1, VB.NET code:

Public Class class1
Public varisbleX As Integer = 1
Public Class class2

[code]....

View 1 Replies

VS 2008 Reference Parent Class From Inside Child Class?

Apr 11, 2009

I have a 'property management class' that contains several functions and properties. I have several other classes that use the 'management class' as a property to derive the value of several of its other properties.Is there a way for me to reference the outer class from the 'management class' functions without having to pass it as a parameter? I ask because several different classes can have this 'management class' as a property and am having a hard time typing the parameter.

View 7 Replies

Call A Member Through Its Parent's Type That Shadowed A Parent Class Implementation?

Aug 3, 2011

This is a challenging one that got me stumped while I was coding today. Suppose I am running the Sub Test1() and Test2() and would like to print out the value of the Shadows method of the instance of the object I am passing in to TestCall() (see below - it is clearer) using the following restrictions:

Can't change the contents of Class A, B, and C
Can't change Sub Test1() and Sub Test2()
TestCall() can't have an if, select case etc. statement that tries to figure out the type

[code].....

View 2 Replies

Reference A Parent Class Object From A Child Class?

Jan 2, 2010

I have a Parent Class Called Fuselage that containsfour child classes called Forebody, CenterBody, AftBody, and CrossSection. CrossSection classcontains objects common to Forebody, CenterBody, and Aftbody (example: width). How do I access thewidth property in CrossSection from within the classForebody?

Public Class Fuselage
Dim Forebody As ClsSection
Dim Centerbody As ClsSection

[code].....

View 6 Replies

Close Parent And Child Forms?

Oct 5, 2009

I have been looking around at how I can close my parent form and my child form. This article: [URL] has some information but it either doesn't work for me or I am putting the wrong information it. What I want to happen is when a button is pressed I want to close both parent and child forms and then go to another form (frmResults). Then there will be a button on frmResults that will take me to the beginning form (frmPTCalculator). With this code below when I click the button on frmCalculator it goes to the MDI form and both parent and child forms are there.

my Parent form is called: frmGender
my Child form is call: frmMale & frmFemale

Below is what I have tried from the example in my Child form frmMale:

Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResults.Click
Dim frm2 As frmMale = New frmMale()
AddHandler frm2.FormClosed, AddressOf frm2_FormClosed

[code]....

View 3 Replies

Communication Between Child And Parent Forms

Oct 25, 2010

VB.NET 2003 makes it difficult to have a child button create an event on a Parent form control. I would like to change the state of a control on the parent form by using a button on the child form.

View 6 Replies

Forms :: Values From Mdi Parent To Mdi Child?

Dec 15, 2009

Is there any chance to pass values from mdi parent to mdi child.

View 1 Replies

Jncilhinney Or Anyone Parent And Child Forms?

Nov 30, 2011

In all my post I have explained I am a total novice so a little more elementary explanation is normally required in my case. I have tried reading the explanations about Parent and child binding but just cant get it to work.This is what I have:

A parent form called Sites Primary key is pkSitesID Various other fields On that form I have placed a tab control and in page one I dragged SitesInstallation to it there is a relation created in the DBDiagram to link fkSitesID (in the sitesinstallation table) and pkSitesID

All I want to do is when I navigate through the Sites records the data in the tab page changes according the values I have selected for that given site.

For example: The Siteinstallation maybe Pending or on air.

View 6 Replies

Working With MDI Parent/child Forms?

Feb 28, 2011

I am using a parent for with child forms and i have made the option to "Float" the child windows outside of the parent form and "dock" them back in if you want.I'm doing this with a button on the child form to float/dock it. On the other hand I'd like to use a checkable item on the menu to choose if they are docked or floated from the opening point.

View 6 Replies

VB Reference Parent Member Of A Class Through A Child When Using List Of(T)?

Feb 27, 2012

VB Reference parent member of a class through a child when using List Of(T)?

View 1 Replies

Binding Multiple IDs Into Form With Two Parent / One Child Tables

Apr 3, 2009

I am very new to vb. I have to create a registration form based on the a complainant form and offender form. Complainant form fills out, take the complainant_ID and parse it to registration form to load. Now when the registration form loads, it has registration_Id and complainant_ID, fills out necessary info and add an offender from the offender form and pass back the offender_ID to the registration form..now on this registration form, we have registration_ID, complainant_ID, and offender_ID..complainant and offender can have more than one registration..

Table structures:
Complainant table(complaint_ID, last, first)
Offender table(offender_ID, last, first)
Registration table(registration_ID, complainant_ID, offender_ID, type, desc)

What I have done so far:
Using separate dataset for each form. Complainant/Offender/Registration form load and save fine. But I do not know how to bind these Ids together so they stay in sync.. What I mean, when I add new complainant, take the complainant_Id, parse it to registration to create a new registration for that particular complainant, and also add an offender to that newly created registration, and pass offender_ID back to registration form. I am using visual studio 5 and sql express..

View 1 Replies

Forms :: Merging Statusstrip Child To Mdi Parent?

Mar 29, 2009

ive been trying to get statusstrips merging so i can click a label to bring the child form to the front when i have multiple childforms open. I have this code which does work but on closing it leaves the label on the mdiparent and also im struggling with the bring back to front code. i dont want it to open another form just bring it back to front. I have statusstrip set to visible false on my childform. heres some code for merging, this is in mdi parent:-

Private Sub Form1ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Form1ToolStripMenuItem.Click
Dim NewMDIChild As New Form1
NewMDIChild.MdiParent = Me

[code].....

and some for bring back to front, this is in form1:-

Private Sub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel1.Click
Dim MDIChild As New Form1

[code]....

View 2 Replies

Forms :: Same Menu Shortcuts In MDI Parent And Child

Apr 30, 2009

I want to use the same menu shortcut keys in a MDI child as in the parent...the problem is that the parent seems to receive the Event first and is calling his menu entry. The child (though it does have the focus) does never receive any event whatsoever...I can bypass this behaviour by adding a Textbox to the Menu, and the moment that one has the focus the menu shortcuts are working as expected (child gets it first, after that it's passed through to the parent).

View 1 Replies

Manipulating Controls On Parent Forms From Child

Mar 6, 2012

I'm trying to add a new row to a DataGridView from FORM 2 but I can not succeed, the code I tried is as follows:

[Code]...

Looking like it took time but can not find a solution,

View 1 Replies

VS 2010 Nested MDI Parent/Child Forms?

Mar 3, 2012

I have a MDI project that has a parent and several children forms. In some of the children forms I would like to make one of the forms to be a parent form with children. On this child form I wanted to make a tabbed MDI, which I can do, but I have found out that I can't make a child form a parent, from what I have found.

Is there any way to get around this? (As in nested MDI forms.)

View 1 Replies

Passing Data From Child To Parent Form Which Is A Child Of Another One

Apr 17, 2012

i have three forms

when i click button1 on form1=====> form2.showdialog()
then click button 1 on form2 =====> form3.showdialog
then click button 1 on form 3 =====>

[code].....

View 7 Replies

How To Use The Values From A Child Class In Parent Class

Mar 31, 2012

I have a problem that is frustrating me to no end, I have a overrideable function in a parent class, and the override function in the child class, like below:

[Code]...

When i debug, the value is produced, but it doesn't carry over to the parent class of ski.RetailPrice()what seems to be the problem here?

View 1 Replies

Visual Basic (Coding) - Child Form To Open Within A Panel On Its Parent?

Mar 2, 2012

I have created a (kind of) 'Desktop' Form for the main basis of my program. Basically it is made up of 3 panel controls.

1. Holds all buttons which load the different forms (Like the windows start menu when expanded). name: StartMenuPanel

2. Holds Information on log in deatails. name: LogCheckPanel (very thin panel at top of screen)

3. Main panel which takes up the majority of the screen (where I want the forms to load). name: MainPanel

My aim is: When a button is clicked from the 'StartMenuPanel' the form will load with-in the 'MainPanel'.

I tried changing the start position to 'centre parent', but the panels are in the way so some of the childform is overlayed by the panels.

[Code]...

When I run this I get the following error: 'Top-level control cannot be added to a control'.

I hope I've explained this well enough.

View 7 Replies

Set IsMidContainer In Forms For Parent-child Relationship Forms?

Jul 1, 2009

I know I can set IsMidContainer in forms for parent-child relationship forms. I just want to know if the parent form could be a panel. If so, how can i do it?

View 1 Replies

Display Child Forms Using Menustip In MDI Parent Form?

Apr 7, 2011

When I click on Borrow Book(s) from Transaction menu it should open frmborrow.vb

Also to it should do the same to rest of the menu(s)......

What should i write in the click event for Borrow Books from Menustrip menu

View 7 Replies

Forms - Pass Variable From Child To Parent Like A Function

May 23, 2012

I have created 2 forms (Parent & Child), i want to store the unique textbox value to a variable into the parent form.

[Code]...

View 2 Replies

Forms :: Close And Reopen Child Form Within Parent?

Dec 22, 2010

When my application first loads the parent opens and I select my child form from toolstrip:

'In parent open the form when option is clicked
Public Sub Showfrmitemreview(ByVal sender As Object, ByVal e As EventArgs) Handles itemreivewStripMenuItemA.Click, itemreviewStripMenuItemB.Click

[Code]....

Nothing happens I don't even get an error message. I've played around with the code numerous times and the only thing that worked was to have it open outside of the parent which I do not want to happen.

View 1 Replies

MDI Parent Forms Button Becomes Transparent In Child Form?

Feb 15, 2011

I have a MDI Parent Form and some Child forms.I have some controls on MDI Parent form but as i open child form all the controls of MDI Parent form display in child forms...I m stuck with my application

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved