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);
}
}
}

VulpesPosted Mar 24, 2014, 10:15 AM
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);
VulpesPosted Mar 25, 2014, 5:22 AM
If there are likely to be more than 99 elements in the list then replace -2 with -3.
Farhan ShariffPosted Mar 25, 2014, 4:26 AM
Farhan ShariffPosted Mar 24, 2014, 10:35 AM
Farhan ShariffPosted Mar 24, 2014, 9:58 AM
VulpesPosted Mar 24, 2014, 9:32 AM
This will enable you to use Console.WriteLine to display the elements of the list.