I have datagridview binded to database table and want to achieve some extended functionality.
In a form there is one SplitContainer and on Panel2 is placed those Datagridview.
I would like in Panel1 to get a copy of this same Datagridview to get ability to look at different areas of data. Only difference will be that in the original datagridview column headers have to be hidden and in copy datagridview have to be shown.
Actually, question is how to copy and show (existed and filled) my DataGridView1 in first panel of Split container?
I try that:
Dim mydatagridview As DataGridView = DataGridView1
SplitContainer1.Panel1.Controls.Add(mydatagridview)
This places actual DataGridView to Panel1 but then DataGridView in Panel2 disappears.
How to get it both for getting described scenario?
Answer:
Solution is very simple
Dim copyDataSet As DataSet
copyDataSet = originalDataSet.Copy()
''additionally filtering is possible also
copyDataSet.Tables(0).DefaultView.RowFilter = "input_value>0"
DataGridView2.DataSource = copyDataSet.Tables(0)