LoadCsv() public static méthode

public static LoadCsv ( string filename, bool split ) : ].string[
filename string
split bool
Résultat ].string[
Exemple #1
0
        // Load a CSV file into an array of rows and columns.
        // Assume there may be blank lines but every line has
        // the same number of fields.

        private void ShowResults_Shown(object sender, EventArgs e)
        {
            string[,] values = Helpers.LoadCsv(Program.mainForm.Results, true);
            int num_rows = values.GetUpperBound(0) + 1;
            int num_cols = values.GetUpperBound(1) + 1;

            dgvValues.Columns.Clear();
            dgvValues.Columns.Add("File path", "File path");
            dgvValues.Columns.Add("Results", "Results");

            for (int r = 0; r < num_rows; r++)
            {
                dgvValues.Rows.Add();
                for (int c = 0; c < num_cols; c++)
                {
                    dgvValues.Rows[r].Cells[c].Value = values[r, c];
                }
            }
        }
Exemple #2
0
        private void PrepareTable(bool FirstTime)
        {
            if (Program.mainForm.Tokens != "" || TokenList != null)
            {
                if (FirstTime == true)
                {
                    TokenList = Program.mainForm.Tokens;
                }
                else
                {
                    TokenList = TokenList;
                }
                string[,] values = Helpers.LoadCsv(TokenList, false);
                int num_rows = values.GetUpperBound(0) + 1;
                int num_cols = values.GetUpperBound(1) + 1;

                // Display the data to show we have it.

                // Make column headers.
                // For this example, we assume the first row
                // contains the column names.
                dgvValues.Columns.Clear();
                //for (int c = 0; c < num_cols; c++)
                dgvValues.Columns.Add("Tokens", "Tokens");

                // Add the data.
                for (int r = 0; r < num_rows; r++)
                {
                    dgvValues.Rows.Add();
                    for (int c = 0; c < num_cols; c++)
                    {
                        dgvValues.Rows[r].Cells[c].Value = values[r, c];
                    }
                }
            }
        }