Version

BeforeColRegionRemoved Event

Occurs before a column scrolling region is removed.
Syntax
'Declaration
 
Public Event BeforeColRegionRemoved As BeforeColRegionRemovedEventHandler
public event BeforeColRegionRemovedEventHandler BeforeColRegionRemoved
Event Data

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

PropertyDescription
Cancel (Inherited from System.ComponentModel.CancelEventArgs) 
ColScrollRegion The column scroll region (read-only)
Remarks

The colscrollregion argument returns a reference to a ColScrollRegion object that can be used to set properties of, and invoke methods on, the colscrollregion that was removed. You can use this reference to access any of the returned colscrollregion's properties or methods.

The cancel argument enables you to programmatically prevent the colscrollregion from being removed. This argument can be used to prevent the user from removing the colscrollregion unless a certain condition is met.

This event is generated before a colscrollregion is removed, either programmatically, or by user interaction. A colscrollregion can be removed programmatically by invoking the Remove method of the ColScrollRegions collection.

The BeforeColRegionSplit event is generated before a colscrollregion is split in two.

The BeforeRowRegionSplit event is generated before a rowscrollregion is split in two.

Example
Following code splits the ultraGrid1 into four different scroll regions and shows how one can use BeforeRowRegionRemoved and BeforeColRegionRemoved events to prevent the user from removing the regions.

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.

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

   Private Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button5.Click

       ' Following code sets up the ultraGrid1 with 2 colum-scroll-regions and two
       ' row-scroll-regions and thus having a total of 4 row-col-intersection regions.

       ' Split the column-scroll-region and the row-scroll-region each.
       Me.ultraGrid1.DisplayLayout.ColScrollRegions(0).Split()
       Me.ultraGrid1.DisplayLayout.RowScrollRegions(0).Split()

   End Sub

   Private Sub UltraGrid1_BeforeColRegionRemoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeColRegionRemovedEventArgs) Handles ultraGrid1.BeforeColRegionRemoved

       Debug.WriteLine("ColScrollRegion with index of " & e.ColScrollRegion.Index & " is being removed. Canceling it.")

       ' Set Cancel to true to prevent the user from removing a colum scroll region.
       e.Cancel = True

   End Sub

   Private Sub UltraGrid1_BeforeRowRegionRemoved(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowRegionRemovedEventArgs) Handles ultraGrid1.BeforeRowRegionRemoved

       Debug.WriteLine("RowScrollRegion with index of " & e.RowScrollRegion.Index & " is being removed. Canceling it.")

       ' Set Cancel to true to prevent the user from removing a row scroll region.
       e.Cancel = True

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

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

	// Following code sets up the ultraGrid1 with 2 colum-scroll-regions and two
	// row-scroll-regions and thus having a total of 4 row-col-intersection regions.

	// Split the column-scroll-region and the row-scroll-region each.
	this.ultraGrid1.DisplayLayout.ColScrollRegions[0].Split( );
	this.ultraGrid1.DisplayLayout.RowScrollRegions[0].Split( );

}

private void ultraGrid1_BeforeColRegionRemoved(object sender, Infragistics.Win.UltraWinGrid.BeforeColRegionRemovedEventArgs e)
{

	Debug.WriteLine( "ColScrollRegion with index of " + e.ColScrollRegion.Index + " is being removed. Canceling it." );

	// Set Cancel to true to prevent the user from removing a colum scroll region.
	e.Cancel = true;

}

private void ultraGrid1_BeforeRowRegionRemoved(object sender, Infragistics.Win.UltraWinGrid.BeforeRowRegionRemovedEventArgs e)
{

	Debug.WriteLine( "RowScrollRegion with index of " + e.RowScrollRegion.Index + " is being removed. Canceling it." );

	// Set Cancel to true to prevent the user from removing a row scroll region.
	e.Cancel = true;

}
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