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

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

DataGridViewCell.EditType プロパティ

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

セルホストされる編集コントロールの型を取得します

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

Public Overridable ReadOnly
 Property EditType As Type
Dim instance As DataGridViewCell
Dim value As Type

value = instance.EditType
public virtual Type EditType { get; }
/** @property */
public Type get_EditType ()

プロパティ
DataGridViewTextBoxEditingControl の型を表す Type

解説解説

派生したセルの型では、そのセルホストされる編集コントロールの型を返すように、このプロパティオーバーライドます。DataGridViewButtonCell のように、セル編集コントロールない場合は、EditType プロパティnull 参照 (Visual Basic では Nothing) を返します

使用例使用例

DataGridViewTextBoxCell から派生した CalendarCell クラスEditType プロパティオーバーライドする方法次のコード例示します次のコード例は、「方法 : 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 クラス
IDataGridViewEditingControl
DataGridViewButtonCell クラス
FormattedValueType
DataGridViewCell.EditType プロパティ



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

辞書ショートカット

すべての辞書の索引

「DataGridViewCell.EditType プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS