void readFile() { //int[,] grid = new int[9, 9]; string line; var lines = new List<string[]>(); // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader(fileNametb.Text); while ((line = file.ReadLine()) != null) { string[] Line = line.Split(','); lines.Add(Line); //Console.WriteLine(line); } file.Close(); var data = lines.ToArray(); for (int i = 0; i < 9; ++i) { for (int j = 0; j < 9; ++j) { grid[i, j] = Int32.Parse(data[i][j]); } } MyThread.setGrid(grid); }
//Read file private void goBtn_Click(object sender, EventArgs e) { readFile(); fileNametb.Hide(); goBtn.Hide(); filename_label.Hide(); printGrid(); init(); Console.WriteLine("GRID"); for (int i = 0; i < 9; ++i) { for (int j = 0; j < 9; ++j) { Console.WriteLine(grid[i, j]); } } Console.WriteLine("END GRID"); MyThread.setGrid(grid); }