I have a DataTable that I make a DataView with. In the Dataview, I filter and sort the info from the first DataTable. Then I tried to make a new DataTable out of the DataView where I sorted and filtered the content.
Everything seems to work alright but the new DataTable is null, so I lost the content from the original DataTable and the rest of the function does not work anymore. Also, I am getting an Unreachable Code warning in File B @ System.Data.DataTable dt480 = dv.ToTable();
I'll keep trying to solve this but I'd like to see if I am way off, or on the right track. Thanks in advance.
I have two files where the code is stored.
File A:
static public void ElecOneLine1(System.Data.DataView dv)
{
string Path = Commands.LoadFile();
System.Data.DataTable table = Commands.ReadExcelToTable(Path);
Commands.ElecDv480V(table);
//Commands.OneLineDt(dv);
Commands.InsertElec1LineBlockscd();
Commands.DrawOneLineBuscd("OneLineBackground", 35.5478, 23.3750, 0, table.Rows[0]);
for (int i = 1; i < 8; i++)
{
Commands.DrawOneLineItem("" + table.Rows[1 + i][0], 4 + ((double)i * 3), 12.6835, 0, table.Rows[0], i + 1);
}
}
File B (called "Commands"):
public static DataView ElecDv480V(System.Data.DataTable dt)
{
System.Data.DataView dv = new DataView(dt);
dv.RowFilter = "F1 = '480V'";
dv.Sort = "F2 ASC, F3 ASC";
return dv;
System.Data.DataTable dt480 = dv.ToTable();
}