GrapeCity MultiRow Windows Forms Documentation
Deleting Columns

You can delete columns with shortcut keys or code.

Deleting Columns Using Keys

The user can delete the current column by pressing the Ctrl + Delete keys if the GcMultiRow.AllowUserToDeleteRows property is set to True. This shortcut key is defined in the GcMultiRow.ShortcutKeyManager.

Deleting Columns

Using Code

This example sets the AllowUserToDeleteRows property.

[VB]

GcMultiRow1.AllowUserToDeleteRows = True

[CS]

gcMultiRow1.AllowUserToDeleteRows = true;

Deleting Columns Using Code

You can delete a column using the RowCollection.Remove method.

Using Code

The following code deletes the current column.

[VB]

GcMultiRow1.Rows.RemoveAt(GcMultiRow1.CurrentRow.Index)

[CS]

gcMultiRow1.Rows.RemoveAt(gcMultiRow1.CurrentRow.Index);

An exception is thrown if the index of a non-existent column is specified.

Deleting Columns Using Column Count

You can delete columns by decreasing the value of the RowCount property of the GcMultiRow control.

Deleting Columns

Using Code

This example decreases the row count.

[VB]

GcMultiRow1.RowCount -= 3

[CS]

gcMultiRow1.RowCount -= 3;

You cannot change the column count using the GcMultiRow.RowCount property when the GcMultiRow control is bound to a data source. In such cases, modify the row count (number of records) of the data source.

Deleting Columns in the Data Source

When the GcMultiRow control is bound to a data source, you can delete columns from the control through the data source if both the IBindingList.AllowRemove properties of the data source are set to True.

Deleting All Columns

Execute the RowCollection.Clear method to delete all the columns.

Using Code

This example uses the Clear method.

[VB]

GcMultiRow1.Rows.Clear()

[CS]

gcMultiRow1.Rows.Clear();

A new column is always displayed when the GcMultiRow.AllowUserToAddRows property is set to True. To make the column count zero, set the property to False.

Events for Deleting Columns

The GcMultiRow.RowsRemoving event occurs when you delete columns from the GcMultiRow control. After the columns have been deleted, the GcMultiRow.RowsRemoved event occurs. When a user deletes columns by using the Ctrl + Delete keys, the GcMultiRow.UserDeletingRow and GcMultiRow.UserDeletedRow events occur.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options