By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,088 Members | 992 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,088 IT Pros & Developers. It's quick & easy.

question about binding navigator

P: 20
hello, I have notice that when i drag a table/column from my dataset onto my form, VS2008 automatically populates the form with a binding navigator and some other stuff like the tableadapters and bindingsources.

I was just wondering about the codes that the bindingnavigator uses to add or move to next or first or last etc... i tried viewing the code of the binding navigator itself, but the only code that is written is the code that commits the changes to the database.

can anyone tell me where i can find an example of the binding navigator codes? cuz i want to create a button that does the same thing as the binding navigator (Specifically the addnew(+) part of the binding navigator).

thanks to anyone willing to help ^_^
Nov 9 '08 #1
Share this Question
Share on Google+
1 Reply


P: 20
Ok.... I have just figured out that the code used for the function I need is class.bindingsource.addnew(), took me awhile to figure that out lolz. but now I have a another problem I hope you guys can help me with. I keep getting an error message which has something to do with a foreign key constraint in the child table.



this error pops up when I click the savebutton, this is the code in the button click event

Expand|Select|Wrap|Line Numbers
  1. Try
  2.             Me.Validate()
  3.             Me.PurchaseOrderBindingSource.EndEdit()
  4.             Me.PurchaseOrderTableAdapter.Update(Me.PurchaseOrderDataSet)
  5.             PurchaseOrderDetalPONumberTxt.Text = PurchaseOrderNumberTxt.Text
  6.  
  7.         Catch ex As Exception
  8.             MessageBox.Show(ex.ToString)
  9.         End Try
  10.         Try
  11.             Me.PurchaseOrderDetailBindingSource.EndEdit()
  12.             Me.PurchaseOrderDetailTableAdapter.Update(Me.PurchaseOrderDataSet)
  13.             MessageBox.Show("Saved")
  14.         Catch ex As Exception
  15.             MessageBox.Show(ex.ToString)
  16.         End Try
any ideas why this is happening? I think it has something to do with the table setup in my data base. here is what the tables in my dataset are like

PurchaseOrder(Parent)
-PurchaseOrderID -PK
-Other Information

PurchaseOrderDetail(Child)
-PurchaseOrderDetailID - PK
-PurchasOrderID - FK relation to PurchaseOrderTable.PurchaseOrderID.PK
-Other Information

there are 2 other tables but i doubt that there are any problems in them.As you can see Im Trying to Update two tables at the same time and whenever i click the savebutton only the Purchase Order table saves and i can only save the Purchaseorderdetails table after the purchase Order is saved... please help me ^_^
Nov 9 '08 #2

Post your reply

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