GrapeCity MultiRow Windows Forms Documentation
Hiding Cells and Rows

You can use the Visible property to hide specific cells or rows. When you hide a row, the space that was occupied by that row is now occupied by the next row. When you hide cells, the space occupied by those cells become empty. The layout of the cells does not change.

You cannot hide a row that has not been committed.

Using Code

The following code hides the first row. If the changes in the first row have not been committed (confirmed), or if the row does not exist, an exception is thrown.

[VB]

GcMultiRow1.Rows(0).Visible = False

[CS]

gcMultiRow1.Rows[0].Visible = false;

To determine whether the rows are hidden, you can use the GcMultiRow.GetState method or the Row.Visible property (Section.Visible property).

Using Code

This example gets the row state.

[VB]

Imports GrapeCity.Win.MultiRow

Console.WriteLine((GcMultiRow1.GetState(0) And MultiRowElementStates.Visible) = MultiRowElementStates.Visible)
Console.WriteLine(gcMultiRow1.Rows(0).Visible)

[CS]

using GrapeCity.Win.MultiRow;

Console.WriteLine((gcMultiRow1.GetState(0) & MultiRowElementStates.Visible) == MultiRowElementStates.Visible);
Console.WriteLine(gcMultiRow1.Rows[0].Visible);

When the row is set as visible, you can use the GcMultiRow.GetState method or the Row.Displayed property to determine whether the row is displayed on the screen.

Using Code

This example gets the row state.

[VB]

Imports GrapeCity.Win.MultiRow

Console.WriteLine((GcMultiRow1.GetState(0) And MultiRowElementStates.Displayed) = MultiRowElementStates.Displayed)
Console.WriteLine(gcMultiRow1.Rows(0).Displayed)

[CS]

using GrapeCity.Win.MultiRow;

Console.WriteLine((gcMultiRow1.GetState(0) & MultiRowElementStates.Displayed) == MultiRowElementStates.Displayed);
Console.WriteLine(gcMultiRow1.Rows[0].Displayed);

Because the GcMultiRow.GetState method does not instantiate the target row, it provides good performance. Alternatively, the Visible property and the Displayed property are useful because they provide legible code and you can hide settings using these properties.

Using Code

The following code hides the second cell in the first row.

[VB]

GcMultiRow1.Rows(0).Cells(1).Visible = False

[CS]

gcMultiRow1.Rows[0].Cells[1].Visible = false;

To determine whether a cell is hidden, you can use the GcMultiRow.GetState method or the Cell.Visible property.

Using Code

This example gets the cell state.

[VB]

Imports GrapeCity.Win.MultiRow

Console.WriteLine((GcMultiRow1.GetState(0, 0) And MultiRowElementStates.Visible) = MultiRowElementStates.Visible)
Console.WriteLine(gcMultiRow1.Rows(0).Cells(0).Visible)

[CS]

using GrapeCity.Win.MultiRow;

Console.WriteLine((gcMultiRow1.GetState(0, 0) & MultiRowElementStates.Visible) == MultiRowElementStates.Visible);
Console.WriteLine(gcMultiRow1.Rows[0].Cells[0].Visible);

When the cell is set as visible, you can use the GcMultiRow.GetState method or the Cell.Displayed property to determine whether the cell is displayed.

Using Code

This example gets the cell state.

[VB]

Imports GrapeCity.Win.MultiRow

Console.WriteLine((GcMultiRow1.GetState(0, 0) And MultiRowElementStates.Displayed) = MultiRowElementStates.Displayed)
Console.WriteLine(gcMultiRow1.Rows(0).Cells(0).Displayed)

[CS]

using GrapeCity.Win.MultiRow;

Console.WriteLine((gcMultiRow1.GetState(0, 0) & MultiRowElementStates.Displayed) == MultiRowElementStates.Displayed);
Console.WriteLine(gcMultiRow1.Rows[0].Cells[0].Displayed);

Because the GcMultiRow.GetState method does not instantiate the target cell, it provides good performance. Alternatively, the Visible property and the Displayed property are useful because they provide legible code and you can hide settings using these properties.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options