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

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

DataGridView.BeginEdit メソッド

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

現在のセル編集モードにします。

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

Public Overridable Function
 BeginEdit ( _
    selectAll As Boolean _
) As Boolean
Dim instance As DataGridView
Dim selectAll As Boolean
Dim returnValue As Boolean

returnValue = instance.BeginEdit(selectAll)
public virtual bool BeginEdit (
    bool selectAll
)
public:
virtual bool BeginEdit (
    bool selectAll
)
public boolean BeginEdit (
    boolean selectAll
)
public function BeginEdit (
    selectAll : boolean
) : boolean

パラメータ

selectAll

セル内容をすべて選択する場合true内容選択しない場合false

戻り値
現在のセルが既に編集モードであるとき、または編集モード移行できた場合trueそれ以外場合false

例外例外
例外種類条件

InvalidOperationException

CurrentCell有効なセル設定されていません。

または

CellBeginEdit イベントハンドラで、このメソッド呼び出されました。

InvalidCastException

セルの EditType プロパティ指定された型が、Control 型から派生していません。

または

セルEditType プロパティ指定された型が、IDataGridViewEditingControl を実装していません。

Exception

編集するセルの値を初期化できませんでした。DataError イベントハンドラ存在しないか、ハンドラによって DataGridViewDataErrorEventArgs.ThrowException プロパティtrue設定されました。例外オブジェクト通常、FormatException 型にキャストできます

解説解説
使用例使用例

このメソッド使用方法コード例次に示します

' Override OnMouseClick in a class derived from DataGridViewCell to
 
' enter edit mode when the user clicks the cell. 
Protected Overrides Sub
 OnMouseClick( _
    ByVal e As DataGridViewCellMouseEventArgs)

    If MyBase.DataGridView IsNot Nothing
 Then

        Dim point1 As Point = MyBase.DataGridView.CurrentCellAddress
        If point1.X = e.ColumnIndex And _
            point1.Y = e.RowIndex And _
            e.Button = MouseButtons.Left And _
            Not MyBase.DataGridView.EditMode
 = _
            DataGridViewEditMode.EditProgrammatically Then

            MyBase.DataGridView.BeginEdit(True)

        End If
    End If
End Sub
// Override OnMouseClick in a class derived from DataGridViewCell to
 
// enter edit mode when the user clicks the cell. 
protected override void OnMouseClick(DataGridViewCellMouseEventArgs
 e)
{
    if (base.DataGridView != null)
    {
        Point point1 = base.DataGridView.CurrentCellAddress;
        if (point1.X == e.ColumnIndex &&
            point1.Y == e.RowIndex &&
            e.Button == MouseButtons.Left &&
            base.DataGridView.EditMode !=
            DataGridViewEditMode.EditProgrammatically)
        {
            base.DataGridView.BeginEdit(true);
        }
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridView クラス
DataGridView メンバ
System.Windows.Forms 名前空間
CurrentCell
EditType
Control クラス
IDataGridViewEditingControl
IDataGridViewEditingCell
CellBeginEdit
IsCurrentCellInEditMode
その他の技術情報
DataGridView コントロール (Windows フォーム)



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

辞書ショートカット

すべての辞書の索引

「DataGridView.BeginEdit メソッド」の関連用語

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

   

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



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

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

©2024 GRAS Group, Inc.RSS