private void SizesValueChanged(object sender, EventArgs e) { if (Sizes.Aggregate(Int32.Mul) == 0) { return; } string[,] old = _dataGridViewSrcMatrix.TheData; var nova = new string[VertSize, HorzSize]; for (int i = 0; i < old.GetLength(0) && i < nova.GetLength(0); i++) { for (int j = 0; j < old.GetLength(1) && j < nova.GetLength(1); j++) { nova[i, j] = old[i, j]; } } _dataGridViewSrcMatrix.TheData = nova; }