Is it possible to display the list in console (program is windows form)as list excludedNames has many values. Which is the best way to display the result.?.
Collapse | Copy Codeprivate void bt_compare_Click(object sender, EventArgs e)
{
table1 = GetDataTabletFromCSVFile(tbCSVPath.Text);
table2 = GetDataTabletFromCSVFile1(tbCSVPath1.Text);
List<string> excludedNames = new List<string>();
for (int i = 0; i < table1.Rows.Count; i++)
{
string col = table1.Rows[i]["Par Name"].ToString();
if (!table2.Columns.Contains(col))
{
excludedNames.Add(col);
}
}
}


VulpesRank #55 · 29.2K reputationPosted Mar 24, 2014, 6:15 AM EDT
listBox1.DataSource = excludedNames;
or a multi-line TextBox:
textBox1.Lines = excludedNames.ToArray();
or a MessageBox:
string message = String.Join("\r\n", excludedNames.ToArray());
MessageBox.Show(message);
VulpesRank #55 · 29.2K reputationPosted Mar 24, 2014, 5:32 AM EDT
This will enable you to use Console.WriteLine to display the elements of the list.
Farhan ShariffRank #2,004 · 725 reputationPosted Mar 24, 2014, 5:58 AM EDT
Farhan ShariffRank #2,004 · 725 reputationPosted Mar 24, 2014, 6:35 AM EDT
Farhan ShariffRank #2,004 · 725 reputationPosted Mar 25, 2014, 12:26 AM EDT
VulpesRank #55 · 29.2K reputationPosted Mar 25, 2014, 1:22 AM EDT
If there are likely to be more than 99 elements in the list then replace -2 with -3.