Infragistics(R) NetAdvantage(R) Windows Forms
InitializeRowsCollection Event
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridBase Class : InitializeRowsCollection Event

InitializeRowsCollection event is fired whenever UltraGrid creates a new row collection.


Visual Basic (Declaration) 
Public Event InitializeRowsCollection As InitializeRowsCollectionEventHandler
public event InitializeRowsCollectionEventHandler InitializeRowsCollection

Event Data

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

Rows Gets the row collection that was created.


The following code writes out some information about the row collection being initialized in the InitializeRowsCollection event handler.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub UltraGrid1_InitializeRowsCollection(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowsCollectionEventArgs) Handles UltraGrid1.InitializeRowsCollection
        Dim rows As RowsCollection = e.Rows

        Dim count As Integer = rows.Count
        Dim band As UltraGridBand = rows.Band
        Dim parentRow As UltraGridRow = rows.ParentRow

        Dim parentRowId As String
        If Not Nothing Is parentRow Then
            parentRowId = parentRow.Cells(0).Text
            parentRowId = "{NULL}"
        End If

        System.Diagnostics.Debug.WriteLine(String.Format( _
                "InitializeRowsCollection: count = {0} band = {1}, parent row = {2}", _
                count, band.Key, parentRowId))
    End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void UltraGrid1_InitializeRowsCollection(object sender, Infragistics.Win.UltraWinGrid.InitializeRowsCollectionEventArgs e)
			RowsCollection rows = e.Rows;

			int count = rows.Count;
			UltraGridBand band = rows.Band;
			UltraGridRow parentRow = rows.ParentRow;

			string parentRowId;
			if ( null != parentRow )
				parentRowId = parentRow.Cells[0].Text;
				parentRowId = "{NULL}";
			System.Diagnostics.Debug.WriteLine( string.Format( 
					"InitializeRowsCollection: count = {0} band = {1}, parent row = {2}", 
					count, band.Key, parentRowId ) );


See Also