このプロパティを使用して、セルの値を取得または修正します。セルの値を変更すると、BeforeCellUpdate および AfterCellUpdate イベントが生成され、セルの DataChanged プロパティは True に設定されます。ただし、実際に更新が発生するときに、データソースが採用するレコードのロックのタイプや UpdateMode プロパティの値などのさまざまな要素が影響する可能性があるため、セルの新しい値がプロパティの設定時にデータソースにコミットされている必要はありません。
セルの OriginalValue プロパティは、変更前にセルの値を決定するために使用できます。
GetText メソッドは、セルのフォーマットされた値を返すために起動できます。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub Button63_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button63.Click Dim row As UltraGridRow = Me.UltraGrid1.Rows(1) Dim column As UltraGridColumn = Me.UltraGrid1.DisplayLayout.Bands(0).Columns(1) ' UltraGridCell.Value property returns the same value as returned by GetCellValue below. Dim cellVal1 As Object = row.Cells(column).Value ' UltraGridRow.GetCellValue method returns the cell's value. Dim cellVal2 As Object = row.GetCellValue(column) ' UltraGridCell.Text property returns the same text as returned by GetCellText below ' except when the cell is in edit mode in which case the UltraGridCell.Text returns the ' current text that the user has entered in the cell while UltraGridColumn.GetCellText ' returns the cell's value that's in the bound list converted to text. NOTE: The same ' doesn't hold true for UltraGridCell.Value and UltraGridColumn.GetCellValue where both ' return the values from the bound list regardless of whether the cell is in edit mode and ' the user has modified the cell's value. Dim cellText1 As String = row.Cells(column).Text ' UltraGridRow.GetCellText method returns the cell's value converted to text. Dim cellText2 As String = row.GetCellText(column) Debug.WriteLine("UltraGridCell.Value = " & cellVal1.ToString()) Debug.WriteLine("UltraGridRow.GetCellValue = " & cellVal2.ToString()) Debug.WriteLine("UltraGridCell.Text = " & cellText1) Debug.WriteLine("UltraGridRow.GetCellText = " & cellText2) End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button63_Click(object sender, System.EventArgs e) { UltraGridRow row = this.ultraGrid1.Rows[1]; UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns[1]; // UltraGridCell.Value property returns the same value as returned by GetCellValue below. object cellVal1 = row.Cells[column].Value; // UltraGridRow.GetCellValue method returns the cell's value. object cellVal2 = row.GetCellValue( column ); // UltraGridCell.Text property returns the same text as returned by GetCellText below // except when the cell is in edit mode in which case the UltraGridCell.Text returns the // current text that the user has entered in the cell while UltraGridColumn.GetCellText // returns the cell's value that's in the bound list converted to text. NOTE: The same // doesn't hold true for UltraGridCell.Value and UltraGridColumn.GetCellValue where both // return the values from the bound list regardless of whether the cell is in edit mode and // the user has modified the cell's value. string cellText1 = row.Cells[column].Text; // UltraGridRow.GetCellText method returns the cell's value converted to text. string cellText2 = row.GetCellText( column ); Debug.WriteLine( "UltraGridCell.Value = " + cellVal1.ToString( ) ); Debug.WriteLine( "UltraGridRow.GetCellValue = " + cellVal2.ToString( ) ); Debug.WriteLine( "UltraGridCell.Text = " + cellText1 ); Debug.WriteLine( "UltraGridRow.GetCellText = " + cellText2 ); }