none
how to create a new DataGridViewCellValidatingEventArgs object RRS feed

  • Question

  • i has  override the method of OnCellValidating(DataGridViewCellValidatingEventArgs e) in DataGridView
    and i also want to override the method
    protected override void OnRowValidating(DataGridViewCellCancelEventArgs e)
    and in OnRowValidating method i want to invoke the method of OnCellValidating,do as this:
    protected override void OnRowValidating(DataGridViewCellCancelEventArgs e){
      ...
      DataGridViewCellValidatingEventArgs ex=new DataGridViewCellValidatingEventArgs (columnIndex,rowInde,formatedValue);
    OnCellValidating(ex);
    ...
    base.OnRowValidating(e);
    }
    but the code 
    DataGridViewCellValidatingEventArgs ex=new DataGridViewCellValidatingEventArgs (columnIndex,rowInde,formatedValue);

    is can not run success.throw erros as this:
    错误 125 类型“System.Windows.Forms.DataGridViewCellValidatingEventArgs”未定义构造函数 F:\container\NFramework\NFramework\NFramework\control\NFDataGridView.cs 589 47 NFramework

    i an using visual studio 2005 and .net2.0 to do that,
    can anybody help me?

    • Moved by nobugzModerator Saturday, August 8, 2009 2:48 PM (From:.NET Base Class Library)
    Saturday, August 8, 2009 9:32 AM

Answers

  • That looks like Chinese to me.  I can guess what it says, the constructor is not accessible.  It is marked "internal".  That is invariably done for a good reason, along the lines of "you'll break something if you create your own".  If you really, really want to, you can invoke the constructor by using Reflection.  ConstructorInfo.Invoke().

    Not a BCL q, moved to Windows Forms.

    Hans Passant.
    Saturday, August 8, 2009 2:45 PM
    Moderator

All replies

  • That looks like Chinese to me.  I can guess what it says, the constructor is not accessible.  It is marked "internal".  That is invariably done for a good reason, along the lines of "you'll break something if you create your own".  If you really, really want to, you can invoke the constructor by using Reflection.  ConstructorInfo.Invoke().

    Not a BCL q, moved to Windows Forms.

    Hans Passant.
    Saturday, August 8, 2009 2:45 PM
    Moderator
  • that's good ideal,i'll try as you sead,thanks
    Sunday, August 9, 2009 2:31 AM
  • Dear nobugz,

    How can I create System.Windows.Forms.DataGridViewCellValidatingEventArgs by using Reflection.ConstructorInfo.Invoke() ?

    I am interesting and useful for me, please help!

    Francis SZE

    Wednesday, July 25, 2012 1:03 PM