DataGridViewRow.Cells プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文行内のセルがすべて格納された DataGridViewCellCollection。
解説行にセルが含まれていない場合にこのプロパティにアクセスすると、CreateCellsInstance メソッドの呼び出しにより、新しい空の DataGridViewCellCollection が作成されます。
使用例Cells プロパティを使用して、行内のセルの値を設定するコード例を次に示します。次のコード例は、「方法 : Windows フォームの DataGridView コントロールの行を操作する」で示されている例の一部です。
' 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
// 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); }
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照Weblioに収録されているすべての辞書からDataGridViewRow.Cells プロパティを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からDataGridViewRow.Cells プロパティ
を検索
- DataGridViewRow.Cells プロパティのページへのリンク