I have a csv file like this :
george,
nick,
mary,
john,
micheal
The user can make a file he likes. So he could have 4 or 5 or 28 lines for example.
I have an other csv file, that I assigned it to a ArrayList named fileList1 . This file is an agenda.
If a name in the agenda isn't in the csv, that will be given, then print a message.(this is what I need to find). The point is that both the csv can be dymanical. The number of lines is not standar.
I have also a table, colB[]
. This table has the list of files that will compare with columns.
The problem is that I can not select a specific column in the arraylist because it is an arraylist.
ArrayList fileList1 = new ArrayList();
string stringforData;
private void button1_Click(object sender, EventArgs e)
{
// opens **BROWSE**
string filename = "";
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
filename = openFileDialog1.FileName;
textBox1.Text = filename;
// Read the file and display it line by line.
string line;
System.IO.StreamReader file1 = new System.IO.StreamReader(textBox1.Text); //reads the path from textbox
stringforData = file1.ReadLine();
while ((line = file1.ReadLine()) != null)
{
// bazei stoixeia mesa ston pinaka
fileList1.Add(line.Split(';'));//split the file and assign it in //the fileList1
}
file1.Close();
}
}
private void button3_Click(object sender, EventArgs e)
{
this.textBox2.Clear();
string[] colB = new string[];
for (int j = 0; j < colB.Length; j++)
{
if (Path.GetExtension(colB[j]) == ".csv")
{
string path = Path.GetDirectoryName(textBox1.Text);
string g = Path.Combine(path, colB[j]);
textBox2.Text += "the path is " + g + " " + Environment.NewLine;
System.IO.StreamReader gi = new System.IO.StreamReader(g);
string itemss;
ArrayList ArrayForLists=new ArrayList();
while ((itemss = gi.ReadLine()) != null)
{
ArrayForLists.AddRange(itemss.Split(';'));// assign to the arraylist the list that we are searching
}
}