バージョン

HasCell(Int32) メソッド

指定された列インデックスに関連づけられたセルが作成されたかどうかを示します。
シンタックス
'宣言
 
Public Overloads Function HasCell( _
   ByVal columnIndex As Integer _
) As Boolean
public bool HasCell( 
   int columnIndex
)

パラメータ

columnIndex
列を示すインデックス。

戻り値の型

HasCell メソッドは、列のセルが割り当てられているかどうかを示します。UltraGrid はセルとセル コレクションを遅延して割り当てます(アクセスされた時に)。たとえば、これは以前設定した外観設定をリセットするなどセルで操作を実行したい場合に役に立ち、セルが以前に割り当てられている場合に限って必要となります。このような場合、このメソッドを使用してセルが割り当てられているかどうかを検出し、割り当てられている場合に操作を実行することができます。これによって、セルが必ずしも割り当てられないことが保証されます。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid


    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        Dim row As UltraGridRow = Me.ultraGrid1.Rows(4)
        Dim column As UltraGridColumn = row.Band.Columns("CustomerID")

        ' UltraGrid lazily allocates cells as they are accessed.
        ' If the cell hasn't been accessed yet, HasCell will return false.
        Debug.WriteLine("Cell Allocated? " & row.HasCell(column))

        ' Accessing the cell will cause the UltraGrid to allocate it.
        Dim cell As UltraGridCell = row.Cells(column)

        ' Since we accessed the cell above causing it be allocated, HasCell
        ' will return true.
        Debug.WriteLine("Cell Allocated? " & row.HasCell(column))

        ' You can cause the grid to release references to cells by calling
        ' DeallocateCells. This also means that any cell specific settings
        ' will be cleared.
        row.DeallocateCells()

        ' HasCell will return false since we've de-allocated cells.
        Debug.WriteLine("Cell Allocated? " & row.HasCell(column))
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;


		private void button1_Click(object sender, System.EventArgs e)
		{
			UltraGridRow row = this.ultraGrid1.Rows[4];
			UltraGridColumn column = row.Band.Columns[ "CustomerID" ];

			// UltraGrid lazily allocates cells as they are accessed.
			// If the cell hasn't been accessed yet, HasCell will return false.
			Debug.WriteLine( "Cell Allocated? " + row.HasCell( column ) );

			// Accessing the cell will cause the UltraGrid to allocate it.
			UltraGridCell cell = row.Cells[ column ];

			// Since we accessed the cell above causing it be allocated, HasCell
			// will return true.
			Debug.WriteLine( "Cell Allocated? " + row.HasCell( column ) );

			// You can cause the grid to release references to cells by calling
			// DeallocateCells. This also means that any cell specific settings
			// will be cleared.
			row.DeallocateCells( );

			// HasCell will return false since we've de-allocated cells.
			Debug.WriteLine( "Cell Allocated? " + row.HasCell( column ) );
		}
参照