I'm new to C# and am bumping against an error that I hope someone can assist with.
In my winforms application I have a button that allows the user to select a flat file and the data is imported into a datatable & displayed in a datagridview. No problems with all that
I have a second button on the form where I want to copy certain colums from datatable1 into a new datatable. To do this I am trying to use the following code :-
DataTable uniqueCols = dt1DefaultView.ToTable(true, "dt1column1");
When I try & run this I get an erros stating that
The name 'dt1' does not exist in the current context
I am assuming this is because dt1 is "setup" in the code block for the first button. Am I correct in assuming this & if so how do I "fix" the issue.
Any pointers would be welcomed.