Sugerir traducción
 
Otros han sugerido:

progress indicator
No hay más sugerencias.
Evaluar y enviar comentarios
Contraer todo/Expandir todo Contraer todo
Ver contenido:  en paraleloVer contenido: en paralelo
.NET Framework Class Library
DataGridViewRow..::.Cells Property

Gets the collection of cells that populate the row.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic
<BrowsableAttribute(False)> _
Public ReadOnly Property Cells As DataGridViewCellCollection
    Get
C#
[BrowsableAttribute(false)]
public DataGridViewCellCollection Cells { get; }
Visual C++
[BrowsableAttribute(false)]
public:
property DataGridViewCellCollection^ Cells {
    DataGridViewCellCollection^ get ();
}
F#
[<BrowsableAttribute(false)>]
member Cells : DataGridViewCellCollection

Property Value

Type: System.Windows.Forms..::.DataGridViewCellCollection
A DataGridViewCellCollection that contains all of the cells in the row.

If the row does not contain any cells when this property is accessed, a new empty DataGridViewCellCollection will be created by a call to the CreateCellsInstance method.

The following code example uses the Cells property to set the value of a cell in the row. This code example is part of a larger code example provided in How to: Manipulate Rows in the Windows Forms DataGridView Control.

Visual Basic
' Give cheescake excellent rating.
Private Sub Button8_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button8.Click

    UpdateStars(dataGridView.Rows(4), "******************")
End Sub

Private ratingColumn As Integer = 3

Private Sub UpdateStars(ByVal row As DataGridViewRow, _
    ByVal stars As String)

    row.Cells(ratingColumn).Value = stars

    ' Resize the column width to account for the new value.
    row.DataGridView.AutoResizeColumn(ratingColumn, _
        DataGridViewAutoSizeColumnMode.DisplayedCells)

End Sub
C#
// Give cheescake excellent rating.
private void Button8_Click(object sender,
    System.EventArgs e)
{
    UpdateStars(dataGridView.Rows[4], "******************");
}

int ratingColumn = 3;

private void UpdateStars(DataGridViewRow row, string stars)
{

    row.Cells[ratingColumn].Value = stars;

    // Resize the column width to account for the new value.
    row.DataGridView.AutoResizeColumn(ratingColumn, 
        DataGridViewAutoSizeColumnMode.DisplayedCells);
}
Visual C++
   // Give cheescake excellent rating.
   void Button8_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      UpdateStars( dataGridView->Rows[ 4 ], L"******************" );
   }

   int ratingColumn;
   void UpdateStars( DataGridViewRow^ row, String^ stars )
   {
      row->Cells[ ratingColumn ]->Value = stars;

      // Resize the column width to account for the new value.
      row->DataGridView->AutoResizeColumn( ratingColumn, DataGridViewAutoSizeColumnMode::DisplayedCells );
   }


.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role not supported), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Biblioteca de clases de .NET Framework
DataGridViewRow..::.Cells (Propiedad)

Obtiene la colección de celdas que rellenan la fila.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Visual Basic
<BrowsableAttribute(False)> _
Public ReadOnly Property Cells As DataGridViewCellCollection
    Get
C#
[BrowsableAttribute(false)]
public DataGridViewCellCollection Cells { get; }
Visual C++
[BrowsableAttribute(false)]
public:
property DataGridViewCellCollection^ Cells {
    DataGridViewCellCollection^ get ();
}
F#
[<BrowsableAttribute(false)>]
member Cells : DataGridViewCellCollection

Valor de propiedad

Tipo: System.Windows.Forms..::.DataGridViewCellCollection
DataGridViewCellCollection que contiene todas las celdas de la fila.

Si la fila no contiene ninguna celda cuando se obtiene acceso a esta propiedad, se crea una nueva colección DataGridViewCellCollection vacía mediante una llamada al método CreateCellsInstance.

En el ejemplo de código siguiente se utiliza la propiedad Cells para establecer el valor de una celda de la fila. Este ejemplo de código forma parte de un ejemplo de código más extenso que se proporciona en Cómo: Manipular filas en el control DataGridView de formularios Windows Forms.

Visual Basic
' Give cheescake excellent rating.
Private Sub Button8_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button8.Click

    UpdateStars(dataGridView.Rows(4), "******************")
End Sub

Private ratingColumn As Integer = 3

Private Sub UpdateStars(ByVal row As DataGridViewRow, _
    ByVal stars As String)

    row.Cells(ratingColumn).Value = stars

    ' Resize the column width to account for the new value.
    row.DataGridView.AutoResizeColumn(ratingColumn, _
        DataGridViewAutoSizeColumnMode.DisplayedCells)

End Sub
C#
// Give cheescake excellent rating.
private void Button8_Click(object sender,
    System.EventArgs e)
{
    UpdateStars(dataGridView.Rows[4], "******************");
}

int ratingColumn = 3;

private void UpdateStars(DataGridViewRow row, string stars)
{

    row.Cells[ratingColumn].Value = stars;

    // Resize the column width to account for the new value.
    row.DataGridView.AutoResizeColumn(ratingColumn, 
        DataGridViewAutoSizeColumnMode.DisplayedCells);
}
Visual C++
   // Give cheescake excellent rating.
   void Button8_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      UpdateStars( dataGridView->Rows[ 4 ], L"******************" );
   }

   int ratingColumn;
   void UpdateStars( DataGridViewRow^ row, String^ stars )
   {
      row->Cells[ ratingColumn ]->Value = stars;

      // Resize the column width to account for the new value.
      row->DataGridView->AutoResizeColumn( ratingColumn, DataGridViewAutoSizeColumnMode::DisplayedCells );
   }


.NET Framework

Compatible con: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Compatible con: 4, 3.5 SP1

Windows 7, Windows Vista SP1 o posterior, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (no se admite Server Core), Windows Server 2008 R2 (se admite Server Core con SP1 o posterior), Windows Server 2003 SP2

.NET Framework no admite todas las versiones de todas las plataformas. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Contenido de la comunidad   ¿Qué es Community Content?
Agregar contenido nuevo RSS  Anotaciones
Processing
© 2012 Microsoft. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker