473,408 Members | 2,832 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,408 software developers and data experts.

*Update a parent from the child

I have 2 forms.. a customer form and an addnew customer form. Basicially when you click on the addnew button, the addnew form opens.

In the parent form, I add a new item using the bindingsource... and then I am passing that new item as a datarowview to a child form.

In the child form, all of the controls are bound to a bindingsource component based on the customer. In the constructor for the child form, I am changing the bindingsource.datasource to the datarow that I am passing in. The user makes his edits in the child form, and then when he accepts... the endupdate() method is called on the child's binding source. then in the parent form, I am calling the resetcurrentitem() to pull in the updates that were made in the child.

It seems that the resetcurrentitem, is not functioning as expected, and I don't know why.
Here is a sample of the code.

Parent form on click....
//adding a new item to the datasource in memory and assigning it
//to a new object
datarowview item = (datarowview)this.customerbindingsource.addnew();

//opening the child form, and passing it the item
new_cust_Form dlg = new new_cust_Form(item);

dlg.ShowDialog();
//resetting the binding source in order to capture the updates made by the child form
this.customerbindingsource.resetcurrentitem();


-------------------------------------------------------
//the child form

new_cust_form(datarowview item)

this.custdetailbindingsource.datasource = item



// and then when the form closes...

this.custdetailbindingsource.endedit()

this.close()


everything works ok, except for the resetcurrentitem() is not showing in the parent form
Oct 26 '06 #1
0 1335

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Fraser Hanson | last post by:
Hello, I have a table which has a foreign key relationship with itself. I want and expect my updates to cascade (deletes definitely cascade as expected) but instead I just get error 1217:...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
2
by: Richard | last post by:
Hi, I have 1 dataset with 2 tables (Table1 as parent, Table2 as Child), 1 row in both the tables. I am updating it with a transaction. First parent then child. When child update fails, it raise...
3
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent...
5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
1
by: James Hallam | last post by:
I have a parent record with a child record. The parent record contains structures and the child records contains visits to those structures. Each table has a field named "Complete", what I...
1
by: Hexman | last post by:
Hello All, What I'm trying to do is update a child record using a parent-child relation. I want to find out if it is faster than than doing multiple selects. Anyways, I've created a dataset...
6
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem :...
3
by: G .Net | last post by:
Hi Everybody I was wondering if anybody could help me with something that has been bothering me for some time. Basically, it is a problem I encountered some time ago with DataSets. I found a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.