Passing data between DataTables

charlie20

Member
Joined
Aug 27, 2012
Messages
11
Programming Experience
Beginner
Hia,

I'm looking to move data between two DataTables (with a twist) & am looking for some guidance......

I have a WinForms application that works as follows :-
- Form_A is the main form & has graphing elements on it
- Form_A has two DataTables (a RawDT & an AnalysisDT)
- Form_A calls Form_B
- Form_B is used to import data from flat files (.csv, etc.)
- Form_B has two DataTables (an OriginalDT & a FilteredDT)
- Form_B allows the user to select just a single column from the original flat file to import.

The idea behind the application is that the user can import a single column of numerical data, from a flat file. Analysis is then performed on the data, the results of which is then presented back to the user graphically.

I have the above working however I am struggling with passing the data from Form_B.FilteredDT to Form_A.RawDT. I've tried CopyToDataTable() without success as well as variations on :-
frm_Main ImportTo = new frm_Main();
ImportTo.RawDataGrid = FilteredDT;
Any suggestions / pointers would be most helpful.

Thanks all.
 
Last edited:

charlie20

Member
Joined
Aug 27, 2012
Messages
11
Programming Experience
Beginner
Hi jmcilhinney,

Happy festive season to you.

Thanks for the reply - I've managed to resolve the questions though by placing all the DataTables into a seperate class & made them public. This has led to additional queries which I'll post shortly.

KR
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,124
Location
Sydney, Australia
Programming Experience
10+
I suggest that you provide a more detailed explanation of what you're trying to achieve because I'm positive that that solution is not a good one and the whole thing could be far more streamlined. I suspect that your FilteredDT is unnecessary for a start and that you could simply use a DataView.
 

charlie20

Member
Joined
Aug 27, 2012
Messages
11
Programming Experience
Beginner
Ok - here goes......

- User selects to import data (from .csv or .xls)
- OpenFileDialog launches & User selects file
- File is read into OriginalDT & the column headers are extracted to populate a ComboBox list
- The User then selects the appropriate column to import from the ComboBox list options
- The data is then "filtered" from OriginalDT & presented back to the user in a DataGridView for confirmation
- The User then confirms the selection (cmdButton) & the data is saved into FilteredDT.
- This data is then manipulated / transformed & is used to populate RawDT (subject of a seperate post)
- The RawDT data is then run through some statistical analysis with the results being saved into AnalysisDT
- Results (AnalysisDT) are then presented back to the User graphically & is output in a report format with all the data extracted to an Access datatbase for record keeping.

It's a bit of a long winded process, however due to required checks this was deemed to be the most logical way to process each step. Each stage of the process needs to potentially be verifiable outside of the app so hence the recording of each part (sigh).

Hope that makes the process clearer? Am open to other suggestions though on how to do it more efficiently.

Thanks for the interest.

KR
 

charlie20

Member
Joined
Aug 27, 2012
Messages
11
Programming Experience
Beginner
Hi,

Not sure why this has been moved to ADO.NET as I'm not using ADO ??

Thanks
 
Top Bottom