バージョン

BeforeRowInsertEventHandler デリゲート

行が挿入される前に発生するイベントを処理するためのデリゲート。
シンタックス
'宣言
 
Public Delegate Sub BeforeRowInsertEventHandler( _
   ByVal sender As Object, _
   ByVal e As BeforeRowInsertEventArgs _
) 
public delegate void BeforeRowInsertEventHandler( 
   object sender,
   BeforeRowInsertEventArgs e
)

パラメータ

sender
e
使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Imports System.Diagnostics

   Private Sub UltraGrid1_BeforeRowInsert(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs) Handles ultraGrid1.BeforeRowInsert

       ' 行を追加するために新規追加ボタンがクリックされたときに、
       ' BeforeRowInsert を発生しますこのイベントでは、条件的に行の追加を回避するために、
       ' Cancel を True に設定できます

       ' 行が追加される行コレクションにもアクセスできます
       Dim rowsColl As RowsCollection = Nothing
       If Nothing Is e.ParentRow Then
           ' ParentRow が null の場合、行は一番上の行コレクションに追加されます
           ' UltraGrid の Rows プロパティを使用してアクセスできます
           rowsColl = Me.ultraGrid1.Rows
       Else
           ' ParentRow が null でない場合、行は子孫バンドに追加されますここに
           ' 行コレクションを取得します
           rowsColl = e.ParentRow.ChildBands(e.Band).Rows
       End If

       Debug.WriteLine("Row is being added to rows collection with " & rowsColl.Count.ToString() & " number of rows.")

       Dim result As DialogResult = MessageBox.Show("You are about to add a row to " & e.Band.Key & ". Continue ?", _
                                                       "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

       ' UltraGrid で行の追加を中止するために Cancel を True に設定します
       If DialogResult.No = result Then
           e.Cancel = True
       End If

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

private void ultraGrid1_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e)
{

	// 行を追加するために新規追加ボタンがクリックされたときに、
	// BeforeRowInsert を発生しますこのイベントでは、条件的に行の追加を回避するために、
	// Cancel を True に設定できます

	// 行が追加される行コレクションにもアクセスできます
	RowsCollection rowsColl = null;
	if ( null == e.ParentRow )
	{
		// ParentRow が null の場合、行は一番上の行コレクションに追加します
		// UltraGrid の Rows プロパティを使用するとアクセスできます
		rowsColl = this.ultraGrid1.Rows;
	}
	else
	{
		// ParentRow が null でない場合、行は子孫バンドに追加されますここに
		// 行コレクションを取得します
		rowsColl = e.ParentRow.ChildBands[ e.Band ].Rows;
	}

	Debug.WriteLine( "Row is being added to rows collection with " + rowsColl.Count.ToString( ) + " number of rows." );

	DialogResult result = MessageBox.Show( 
		"You are about to add a row to " + e.Band.Key + ". Continue ?", "Confirm",
		MessageBoxButtons.YesNo, MessageBoxIcon.Question );

	// UltraGrid で行の追加を中止するために Cancel を True に設定します
	if ( DialogResult.No == result )
		e.Cancel = true;

}
参照