DataGridViewCell.GetFormattedValue メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCell.GetFormattedValue メソッドの意味・解説 

DataGridViewCell.GetFormattedValue メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

表示用に書式指定済みセル値を取得します

名前空間: System.Windows.Forms
アセンブリ: 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
)
JScript では、値型引数参照渡しされません。

パラメータ

value

書式設定される値。

rowIndex

セルの親行のインデックス

cellStyle

セル反映される DataGridViewCellStyle。

valueTypeConverter

書式指定済みの値の型へカスタム変換実行する、元の値の型に関連付けられた TypeConverter。カスタム変換不要な場合null 参照 (Visual Basic では Nothing)。

formattedValueTypeConverter

書式指定済みの値の型からカスタム変換実行する、その値の型に関連付けられた TypeConverterカスタム変換不要な場合null 参照 (Visual Basic では Nothing)。

context

書式指定済みの値が必要とされているコンテキストを示す DataGridViewDataErrorContexts 値のビットごとの組み合わせ

戻り値
書式指定済みセル値。または、セルが 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 値が含まれている場合、このメソッドオーバーライドする派生クラス通常セル値の文字列形式返します

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
FormattedValueType
DataGridView クラス
DataGridView.CellFormatting イベント
DataGridView.DataError イベント
DataGridViewCellFormattingEventArgs.FormattingApplied
TypeConverter
DataGridViewCellStyle
DataGridViewCellStyle.Format
DataGridViewDataErrorContexts
ParseFormattedValue


このページでは「.NET Framework クラス ライブラリ リファレンス」からDataGridViewCell.GetFormattedValue メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDataGridViewCell.GetFormattedValue メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDataGridViewCell.GetFormattedValue メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewCell.GetFormattedValue メソッド」の関連用語

DataGridViewCell.GetFormattedValue メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewCell.GetFormattedValue メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS