Version

HasPrevSibling(Boolean) Method

Returns a Boolean expression indicating whether a row has a sibling row above it.
Syntax
'Declaration
 
Public Overloads Function HasPrevSibling( _
   ByVal spanBands As Boolean _
) As Boolean
public bool HasPrevSibling( 
   bool spanBands
)

Parameters

spanBands
True will look for rows in previous sibling bands.

Return Value

true if a row has a sibling row above it.
Remarks

Invoke this method to determine whether a row has a sibling row above it. If a sibling row exists above the row, this method returns True; otherwise, this method returns False.

The spanbands argument can be used to indicate whether rows in other bands are considered siblings.

A reference to a sibling row can be returned by invoking the GetSibling method.

The HasChild, HasNextSibling, and HasParent methods can be invoked to determine whether a row has a child row, a sibling row after it, and a parent row, respectively.

Example
Following code shows how to loop through rows using GetSibling, HasNextSibling and HasPrevSibling methods.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub Button72_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button72.Click

       ' Following code loops throug all the top level rows in the UltraGrid.
       ' It prints out the row indexes for illustration purposes.

       ' Get the first row in the UltraGrid.
       Dim row As UltraGridRow = Me.ultraGrid1.GetRow(ChildRow.First)

       ' Write the index of the row.
       Debug.WriteLine("" & row.Index)

       While row.HasNextSibling(True, False)
           row = row.GetSibling(SiblingRow.Next, True, False)

           ' Write the index of the row.
           Debug.WriteLine("" & row.Index)
       End While

   End Sub


   Private Sub Button73_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button73.Click

       ' Following code loops throug all the top level rows in the UltraGrid backwards.
       ' It prints out the row indexes for illustration purposes.

       ' Get the last row in the UltraGrid.
       Dim row As UltraGridRow = Me.ultraGrid1.GetRow(ChildRow.Last)

       ' Write the index of the row.
       Debug.WriteLine("" & row.Index)

       While row.HasPrevSibling(True, False)
           row = row.GetSibling(SiblingRow.Previous, True, False)

           ' Write the index of the row.
           Debug.WriteLine("" & row.Index)
       End While

   End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button72_Click(object sender, System.EventArgs e)
{

	// Following code loops throug all the top level rows in the UltraGrid.
	// It prints out the row indexes for illustration purposes.

	// Get the first row in the UltraGrid.
	UltraGridRow row = this.ultraGrid1.GetRow( ChildRow.First );

	// Write the index of the row.
	Debug.WriteLine( "" + row.Index );

	while ( row.HasNextSibling( true, false ) )
	{
		row = row.GetSibling( SiblingRow.Next, true, false );

		// Write the index of the row.
		Debug.WriteLine( "" + row.Index );
	}

}

private void button73_Click(object sender, System.EventArgs e)
{

	// Following code loops throug all the top level rows in the UltraGrid backwards.
	// It prints out the row indexes for illustration purposes.

	// Get the last row in the UltraGrid.
	UltraGridRow row = this.ultraGrid1.GetRow( ChildRow.Last );

	// Write the index of the row.
	Debug.WriteLine( "" + row.Index );

	while ( row.HasPrevSibling( true, false ) )
	{
		row = row.GetSibling( SiblingRow.Previous, true, false );

		// Write the index of the row.
		Debug.WriteLine( "" + row.Index );
	}

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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