У меня есть CSV-файл, как это:
george,
nick,
mary,
john,
micheal
Пользователь может создать файл, который ему нравится. Например, он может иметь 4, 5 или 28 строк.
У меня есть другой CSV-файл, который я назначил для ArrayList с именем fileList1. Этот файл является повесткой дня.
Если имя в повестке дня отсутствует в csv , ему будет дано , затем напечатайте сообщение. (это то, что мне нужно найти). Дело в том, что оба CSV могут быть dymanical. Количество строк не является стандартным.
У меня также есть стол, colB[]
. Эта таблица содержит список файлов, которые будут сравниваться со столбцами.
Проблема в том, что я не могу выбрать конкретный столбец в массиве, потому что он является списком.
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
}
}