Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

I have a two datagridviews in a WindowsForm from two tables - It is a Form like father x child - I want to synchronize the two DataGridViews

$
0
0

Hi folks,

I will try to be concise as much as possible.

I have a WindowsForm with two tables. I put two DataGridviews in it. The tables have, the first one: Father (CalledInvoices)

has - cod_entry_Invoice as primary key - (Identity 1,1)

The sencond table Child, (called numbers_of_payments) has two primary Keys:

cod_entry_Invoice primary Key (non Identity) Not null;

cod_number_payments primary Key (Identity 1,1) (Double Keys on the child table)

1st. datagrid - DataGridView_Invoices

2º  datagrid - DataGridView_number_of_payments

___XXXX_____XXX______XXXX______________

I´m using Invoicebindingsource.DataSource = DataConxtextFactory.DataContext.Inoices to fill the Grid on the form load.

and the same, numberofpaymentsbindingsource.DataSource = DataContextFactory.DataContext.numberofpayments to fill the second grid. 

All these are working very well. No problem at all. Saving, navegating and etc.

Questions:

1º - How to synchronize the two DataGridViews on the form load, making the cod of Invoice on the first grid, match the cod of number of payments on the second grid, once that the  Invoice "1" will load the corresponding number of payments"1" in another words. The same cod_entry_Invoice on both grids, and load only the lines of the  secondgrid, corresponding to the first Grid? 

2º - I have two buttons - Forward and back.  I will have the same synchronization on these two buttons. ?

3º - Tips - If you are doing well, how to make a relation on both DataGridViews (or tables), where once I clik in one Cod_Entry_Invoice (DataGridView) takes me to the number_of_payment (DataGridView) below? where to put the code?

Thanks in advance. This is very usefull and is missing posts on that.

Obs.: On the FormLoad, all these grids are populating (filling) the grid with full data from the tables. The thing is, not syncronized on Forward and Back.

Best Regards.

Flávio Rocha.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>