DataGridViewCell.Value プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

セルに表示されるデータを取得または設定します。既定値は null 参照 (Visual Basic では Nothing) です。


別の値をセルに割り当てると、DataGridView コントロールの CellValueChanged イベントが発生します。
Value プロパティが、セルに格納されている実際のデータ オブジェクトであるのに対し、FormattedValue プロパティは、データの書式指定済みの表現です。ValueType プロパティと FormattedValueType プロパティは、これらの値のデータ型にそれぞれ対応しています。
Value プロパティを設定すると、指定された値は、書式設定された表示用の値から、基になるセル値に自動変換されません。たとえば、セルに対して有効な DataGridViewCellStyle が無視されるため、Value を DataGridViewCellStyle.NullValue に設定すると、DataGridViewCellStyle.DataSourceNullValue のプロパティ値が生成されなくなります。

Value プロパティを使用してセルの内容を更新する方法を次のコード例に示します。次のコード例は、「方法 : 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に収録されているすべての辞書からDataGridViewCell.Value プロパティを検索する場合は、下記のリンクをクリックしてください。

- DataGridViewCell.Value プロパティのページへのリンク