GrapeCity MultiRow Windows Forms Documentation
Adding Columns

When performing column operations using the column mode, you can use the row index to specify the target column since the rows and columns are reversed.

This section explains the various methods for adding columns.

Adding Columns by the Users

The user can add columns using the editor displayed in the right most column of the GcMultiRow control when the AllowUserToAddRows property is set to True.

Using Code

This example sets the AllowUserToAddRows property.

[VB]

GcMultiRow1.AllowUserToAddRows = True

[CS]

gcMultiRow1.AllowUserToAddRows = true;

If the GcMultiRow.AllowUserToAddRows property is set to False, the editor is not displayed in the right most column of the GcMultiRow control, and the user cannot add any columns.

Hiding a New Column

Using Code

This example sets the AllowUserToAddRows property.

[VB]

GcMultiRow1.AllowUserToAddRows = False 

[CS]

gcMultiRow1.AllowUserToAddRows = false;

Adding Columns Through Code

You can add a column using the RowCollection.Insert method or the RowCollection.Add method.
Adding Columns

Using Code

This example adds rows.

[VB]

GcMultiRow1.Rows.Add() 

[CS]

gcMultiRow1.Rows.Add();

You cannot add rows using the RowCollection.Add method when the GcMultiRow control is bound to a data source. In such cases, add rows in the data source (for example, use the BindingSource.AddNew method or DataTable.Rows.Add method).

Using Code

This example inserts rows.

[VB]

GcMultiRow1.Rows.Insert(2) 

[CS]

gcMultiRow1.Rows.Insert(2);

Adding Columns Using Column Count

You can change the column count of the GcMultiRow control to add additional columns to the control.

Adding Columns

Using Code

This example increases the column count.

[VB]

GcMultiRow1.RowCount += 3

[CS]

gcMultiRow1.RowCount += 3;

You cannot change the row count using the GcMultiRow.RowCount property when the GcMultiRow control is bound to a data source. In such cases, change the row count (record count) in the data source.

Adding Rows Using the Data Source

When the GcMultiRow control is bound to the data source, you can add rows to the GcMultiRow control though the data source by setting both IBindingList.AllowNew properties to true.

Events for Adding Rows

The GcMultiRow.RowsAdding event occurs when you add a row to the GcMultiRow control. After the row is added, the GcMultiRow.RowsAdded event occurs. The GcMultiRow.UserAddedRow event occurs when the user adds a row using the Row Editor.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options