Resolved Merge Bindingsources to a Master

windoz

Member
Joined
Apr 7, 2022
Messages
5
Programming Experience
1-3
Hi,

Can anyone be kind enough to assist me with the following situation;

I have a weekly data file (.csv) and a historic datafile (.csv) and I wish to merge these together and present this within a datagridview.

I have 1 command button which loads the Weekly Data and displays that in Datagridview1 (DGV_Weekly)
I have 1 command button which loads the Historic data and displays that in Datagridview2 (DGV_Historic)

Both the headers are the same for weekly and historic within the .csv, how can I now combine these both to have this displayed in Datagridview3 (DGV_Master) ?

I have created bindingsources for each BS_Weekly, BS_Historic but somehow I cannot get this to display in the datagridview3.

Any ideas or another method in achieving this ?

The weekly file is generated on a system and outputs this within 20 seconds but this runs every 7 minutes on a daily basis. If I get the system to generate a combined weekly and historic .csv it takes upto 5 mins to do and causes a system load and everything runs slow, doing this every 7 minutes will make things unusable. I usually generate the historic file on a daily midnight routine)

Much appreciated for any advice or help offered.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,717
Location
Sydney, Australia
Programming Experience
10+
A BindingSource can only have one data source and so can a DataGridView. If you read the historic data into one DataTable and the weekly into another, you can create a copy of the first and merge the second into it, then bind that to a third BindingSource and bind that to the third grid.
VB.NET:
Dim table3 = table1.Copy()

table3.Merge(table2)
 

Latest posts

Top Bottom