private void button2_Click(object sender, EventArgs e) { _width = Int32.Parse(widthTextBox.Text); _height = Int32.Parse(heightTextBox.Text); _matrix = new int[_width, _height]; for (int x = 0; x < _width; x++) { for (int y = 0; y < _height; y++) { _matrix[x, y] = Int32.Parse(dataGridView1.Rows[y].Cells[x].Value.ToString()); } } _form.UpdateKernel(_width, _height, _matrix); this.Close(); }