DataGridViewCell.DefaultNewRowValue プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCell.DefaultNewRowValue プロパティの意味・解説 

DataGridViewCell.DefaultNewRowValue プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

新しレコードの行のセル対す既定値取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Overridable ReadOnly
 Property DefaultNewRowValue As Object
Dim instance As DataGridViewCell
Dim value As Object

value = instance.DefaultNewRowValue
public virtual Object DefaultNewRowValue { get;
 }
public:
virtual property Object^ DefaultNewRowValue {
    Object^ get ();
}
/** @property */
public Object get_DefaultNewRowValue ()
public function get DefaultNewRowValue
 () : Object

プロパティ
既定値を表す Object

解説解説

基本クラス DataGridViewCell の DefaultNewRowValue プロパティは、常に null 参照 (Visual Basic では Nothing) を返します。ただし、このプロパティは、他の既定値返すように、派生されたセル クラスオーバーライドできます

このプロパティ返す値は、新しレコードの行にセル存在する場合表示されます。この値は、新しレコードの行にフォーカス移動したときに DataGridView.DefaultValuesNeeded イベントハンドラオーバーライドできます

使用例使用例

DataGridViewTextBoxCell から派生した CalendarCell クラスDefaultNewRowValue プロパティオーバーライドする方法次のコード例示します次のコード例は、「方法 : Windows フォーム DataGridView Cellsコントロールホストする」で示されている例の一部です。

Public Class CalendarCell
    Inherits DataGridViewTextBoxCell

    Public Sub New()
        ' Use the short date format.
        Me.Style.Format = "d"
    End Sub

    Public Overrides Sub
 InitializeEditingControl(ByVal rowIndex As
 Integer, _
        ByVal initialFormattedValue As Object,
 _
        ByVal dataGridViewCellStyle As DataGridViewCellStyle)

        ' Set the value of the editing control to the current cell value.
        MyBase.InitializeEditingControl(rowIndex, initialFormattedValue,
 _
            dataGridViewCellStyle)

        Dim ctl As CalendarEditingControl =
 _
            CType(DataGridView.EditingControl, CalendarEditingControl)
        ctl.Value = CType(Me.Value, DateTime)

    End Sub

    Public Overrides ReadOnly
 Property EditType() As Type
        Get
            ' Return the type of the editing contol that CalendarCell
 uses.
            Return GetType(CalendarEditingControl)
        End Get
    End Property

    Public Overrides ReadOnly
 Property ValueType() As Type
        Get
            ' Return the type of the value that CalendarCell contains.
            Return GetType(DateTime)
        End Get
    End Property

    Public Overrides ReadOnly
 Property DefaultNewRowValue() As Object
        Get
            ' Use the current date and time as the default value.
            Return DateTime.Now
        End Get
    End Property

End Class
public class CalendarCell : DataGridViewTextBoxCell
{

    public CalendarCell()
        : base()
    {
        // Use the short date format.
        this.Style.Format = "d";
    }

    public override void InitializeEditingControl(int
 rowIndex, object 
        initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
    {
        // Set the value of the editing control to the current cell
 value.
        base.InitializeEditingControl(rowIndex, initialFormattedValue,
 
            dataGridViewCellStyle);
        CalendarEditingControl ctl = 
            DataGridView.EditingControl as CalendarEditingControl;
        ctl.Value = (DateTime)this.Value;
    }

    public override Type EditType
    {
        get
        {
            // Return the type of the editing contol that CalendarCell
 uses.
            return typeof(CalendarEditingControl);
        }
    }

    public override Type ValueType
    {
        get
        {
            // Return the type of the value that CalendarCell contains.
            return typeof(DateTime);
        }
    }

    public override object DefaultNewRowValue
    {
        get
        {
            // Use the current date and time as the default value.
            return DateTime.Now;
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
DataGridView クラス
Value
FormattedValue


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

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

辞書ショートカット

すべての辞書の索引

DataGridViewCell.DefaultNewRowValue プロパティのお隣キーワード
検索ランキング

   

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



DataGridViewCell.DefaultNewRowValue プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS