GrapeCity MultiRow Windows Forms Documentation
Adding Rows

The user can add rows using the row editor displayed in the bottom row of the GcMultiRow control when the AllowUserToAddRows property is set to True. The following image displays the row editor.

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 row editor is not displayed at the bottom of the GcMultiRow control and the user cannot add rows.

Using Code

This example sets the AllowUserToAddRows property to false.

[VB]

GcMultiRow1.AllowUserToAddRows = False

[CS]

gcMultiRow1.AllowUserToAddRows = false;

Adding Rows Using Code

You can add a row using the RowCollection.Insert method or the RowCollection.Add method.

Using Code

This example uses the Add method.

[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. If the control is bound to a data source, add rows in the data source (for example, use the BindingSource.AddNew method or DataTable.Rows.Add method).

Adding Rows Using Row Count

You can change the row count of the GcMultiRow control to add additional rows to the control.

Using Code

This example increases the row count.

[VB]

GcMultiRow1.RowCount += 1

[CS]

gcMultiRow1.RowCount += 1;

You cannot change the row count using the GcMultiRow.RowCount property when the GcMultiRow control is bound to a data source. If the control is bound to a data source, 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