SourceGrid.Grid.Redim C# (CSharp) Method

Redim() public method

Set the number of columns and rows
public Redim ( int p_Rows, int p_Cols ) : void
p_Rows int
p_Cols int
return void
        public void Redim(int p_Rows, int p_Cols)
        {
            RowsCount = p_Rows;
            ColumnsCount = p_Cols;
        }

Usage Example

		public void SelectRow_ShouldMaintain_ActivePosition()
		{
			// set up special conditions
			var grid = new Grid();
			grid.Redim(1, 1);
			grid[0, 0] = new Cell();
			
			var form = new Form();
			form.Controls.Add(grid);
			form.Show();

			grid.SelectionMode = GridSelectionMode.Row;
			grid.Selection.EnableMultiSelection = false;
			
			
			// just assert that we have correct conditions for test, 
			// active position should not be empty
			grid.Selection.Focus(new Position(0, 0), true);
			Assert.AreEqual(new Position(0, 0), grid.Selection.ActivePosition);
			
			// this method causes first row to be selected. Should not fail 
			// it failed once in RowSelection.SelectRow method
			// As call to ResetSelection asked to maintain focus, a stack overflow was raised
			grid.Selection.SelectRow(0, true);
			Assert.AreEqual(new Position(0, 0), grid.Selection.ActivePosition);
			
			// destroy
			form.Close();
			form.Dispose();
		}
All Usage Examples Of SourceGrid.Grid::Redim