GrapeCity MultiRow Windows Forms Documentation
NewRowNeeded Event
Example 


Occurs when the VirtualMode property of a GcMultiRow control is true and the user navigates to the new row at the bottom of the GcMultiRow control.
Syntax
<SRCategoryAttribute("Data")>
<SRDescriptionAttribute("Occurs when the VirtualMode property of the GcMultiRow control is true and the user navigates to the new row at the bottom of GcMultiRow.")>
<FeatureAttribute(Name="VirtualMode", Version="v5.0")>
Public Event NewRowNeeded As EventHandler(Of RowEventArgs)
Dim instance As GcMultiRow
Dim handler As EventHandler(Of RowEventArgs)
 
AddHandler instance.NewRowNeeded, handler
[SRCategory("Data")]
[SRDescription("Occurs when the VirtualMode property of the GcMultiRow control is true and the user navigates to the new row at the bottom of GcMultiRow.")]
[Feature(Name="VirtualMode", Version="v5.0")]
public event EventHandler<RowEventArgs> NewRowNeeded
Event Data

The event handler receives an argument of type RowEventArgs containing data related to this event. The following RowEventArgs properties provide information specific to this event.

PropertyDescription
RowGets the Row that is involved.  
Remarks

This event is optional in virtual mode. Use this event if you want to automatically generate values when the current cell is in an uncommitted new row such as a database. Handle this event, and then change the value of the cells in the RowEventArgs.Row property of the RowEventArgs.

When GcMultiRow is in virtual mode, this event allows a new entry to be created in the data store for the new row, and it also allows the row to be populated with default values.

Example
The following code example shows how to automatically add rows when the MultiRow control is in virtual mode. This code example is part of a larger example provided for the VirtualMode property.
void gcMultiRow1_NewRowNeeded(object sender, RowEventArgs e)
        {
            // Add new row when user moves current cell to last new row.
            uncommitNewStudent = new Student(userData.Count, null, 0, 0);
        }
Private Sub gcMultiRow1_NewRowNeeded(ByVal sender As Object, ByVal e As RowEventArgs) Handles 
gcMultiRow1.NewRowNeeded
        ' Add new row when user moves current cell to last new row.
        uncommitNewStudent = New Student(userData.Count, Nothing, 0, 0)
    End Sub
#End Region
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

GcMultiRow Class
GcMultiRow Members
VirtualMode Property
CellValueNeeded Event
CellValuePushed Event
RowDirtyStateNeeded Event
CancelRowEdit Event

 

 


Copyright © GrapeCity, inc. All rights reserved.