DataGridCell.ColumnNumber Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Denetimdeki bir sütunun DataGrid sayısını alır veya ayarlar.
public:
property int ColumnNumber { int get(); void set(int value); };
public int ColumnNumber { get; set; }
member this.ColumnNumber : int with get, set
Public Property ColumnNumber As Integer
Özellik Değeri
Sütunun sayısı.
Örnekler
Aşağıdaki örnek, özelliğini öğesine System.Windows.Forms.DataGridDataGridCellatarCurrentCell. içinde DataTable depolanan değer, ve ColumnNumber özellikleri aracılığıyla RowNumber ve DataColumn nesneleri belirtilerek DataRow döndürülür.
void PrintCell( Object^ sender, MouseEventArgs^ /*e*/ )
{
DataGrid^ thisGrid = dynamic_cast<DataGrid^>(sender);
DataGridCell myDataGridCell = thisGrid->CurrentCell;
BindingManagerBase^ bm = BindingContext[ thisGrid->DataSource,thisGrid->DataMember ];
DataRowView^ drv = dynamic_cast<DataRowView^>(bm->Current);
Console::WriteLine( drv[ myDataGridCell.ColumnNumber ] );
Console::WriteLine( myDataGridCell.RowNumber );
}
private void PrintCell(object sender, MouseEventArgs e)
{
DataGrid thisGrid = (DataGrid) sender;
DataGridCell myDataGridCell = thisGrid.CurrentCell;
BindingManagerBase bm = BindingContext[thisGrid.DataSource, thisGrid.DataMember];
DataRowView drv = (DataRowView) bm.Current;
Console.WriteLine(drv [myDataGridCell.ColumnNumber]);
Console.WriteLine(myDataGridCell.RowNumber);
}
Private Sub PrintCell(sender As Object, e As MouseEventArgs)
Dim thisGrid As DataGrid = CType(sender, DataGrid)
Dim myDataGridCell As DataGridCell = thisGrid.CurrentCell
Dim bm As BindingManagerBase = _
BindingContext (thisGrid.DataSource, thisGrid.DataMember)
Dim drv As DataRowView = CType(bm.Current, DataRowView)
Console.WriteLine(drv(myDataGridCell.ColumnNumber))
Console.WriteLine(myDataGridCell.RowNumber)
End Sub
Açıklamalar
değerini, denetimiyle System.Windows.Forms.DataGrid ilişkili içinde DataTable belirtmek DataColumn için kullanabilirsinizColumnNumber.