DataGridViewCell.GetFormattedValue メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Protected Overridable Function GetFormattedValue ( _ value As Object, _ rowIndex As Integer, _ ByRef cellStyle As DataGridViewCellStyle, _ valueTypeConverter As TypeConverter, _ formattedValueTypeConverter As TypeConverter, _ context As DataGridViewDataErrorContexts _ ) As Object
Dim value As Object Dim rowIndex As Integer Dim cellStyle As DataGridViewCellStyle Dim valueTypeConverter As TypeConverter Dim formattedValueTypeConverter As TypeConverter Dim context As DataGridViewDataErrorContexts Dim returnValue As Object returnValue = Me.GetFormattedValue(value, rowIndex, cellStyle, valueTypeConverter, formattedValueTypeConverter, context)
protected virtual Object GetFormattedValue ( Object value, int rowIndex, ref DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context )
protected: virtual Object^ GetFormattedValue ( Object^ value, int rowIndex, DataGridViewCellStyle^% cellStyle, TypeConverter^ valueTypeConverter, TypeConverter^ formattedValueTypeConverter, DataGridViewDataErrorContexts context )
protected Object GetFormattedValue ( Object value, int rowIndex, /** @ref */ DataGridViewCellStyle cellStyle, TypeConverter valueTypeConverter, TypeConverter formattedValueTypeConverter, DataGridViewDataErrorContexts context )
- valueTypeConverter
書式指定済みの値の型へカスタムの変換を実行する、元の値の型に関連付けられた TypeConverter。カスタムの変換が不要な場合は null 参照 (Visual Basic では Nothing)。
- formattedValueTypeConverter
書式指定済みの値の型からカスタムの変換を実行する、その値の型に関連付けられた TypeConverter。カスタムの変換が不要な場合は null 参照 (Visual Basic では Nothing)。
書式指定済みのセル値。または、セルが DataGridView コントロールに属していない場合は null 参照 (Visual Basic では Nothing)。


DataGridView コントロールは、このメソッドを呼び出して、FormattedValueType プロパティで示される型の等価な表示用の値にセル値を変換します。コントロールは、セル値をこのメソッドの value パラメータに渡します。
このメソッドは、DataGridView.CellFormatting イベントを発生させます。このイベントのハンドラは、value パラメータと cellStyle パラメータの両方を変更できます。ただし、ハンドラが DataGridViewCellFormattingEventArgs.FormattingApplied プロパティを true に設定していない場合、このメソッドは、cellStyle オブジェクトの書式指定のプロパティを使用して、value の書式を設定します。
![]() |
---|
DataSourceNullValue が DBNull.Value や null 参照 (Visual Basic では Nothing) 以外の値に設定されている場合、このメソッドは、DataGridViewCellStyle.DataSourceNullValue プロパティ値に等しい値の DataGridViewCellStyle.NullValue プロパティ値に value を変換しません。この場合、DataGridView.CellFormatting イベントを処理して NullValue プロパティ値を表示できます。詳細については、DataSourceNullValue のコード例を参照してください。 |
書式指定に失敗すると、DataError イベントが発生します。このイベントのハンドラがない場合や、ハンドラで DataGridViewDataErrorEventArgs.ThrowException プロパティを true に設定している場合、例外がスローされます。
context 引数に ClipboardContent 値が含まれている場合、このメソッドをオーバーライドする派生クラスは通常、セル値の文字列形式を返します。

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
FormattedValueType
DataGridView クラス
DataGridView.CellFormatting イベント
DataGridView.DataError イベント
DataGridViewCellFormattingEventArgs.FormattingApplied
TypeConverter
DataGridViewCellStyle
DataGridViewCellStyle.Format
DataGridViewDataErrorContexts
ParseFormattedValue
Weblioに収録されているすべての辞書からDataGridViewCell.GetFormattedValue メソッドを検索する場合は、下記のリンクをクリックしてください。

- DataGridViewCell.GetFormattedValue メソッドのページへのリンク