Home Forums WinForms controls Xceed Grid for WinForms Detecting if BeginInit has been called

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16727 |

    If I call BeginInit is there a way to know that this has been done to ensure that EndInit is called in case of an error after BeginInit was called and is there any problem with calling EndInit if BeginInit has not been called?

     

     

     

    Imported from legacy forums. Posted by Brian (had 1022 views)

    User (Old forums)
    Member
    Post count: 23064

    There is no problem in calling EndInit() without having called BeginInit() previously.  If you want to make sure it is always called, you can simply do it in a try finally block.

    e.g.:

    gridControl1.BeginInit()
    try
    {
       // code
    }
    finally
    {
       gridControl1.EndInit();
    }

    Note that you can always verify the InBatchInitialization property on GridControl to know if the grid is in a batch update (thus BeginInit() has been called).  You will not see it in code completion because its Browsable attribute is set to false.

     

    Imported from legacy forums. Posted by André (had 268 views)

    User (Old forums)
    Member
    Post count: 23064

    Fantastic, this is what I needed to know.  I have the EndInit in my Finally, but wanted to verify that it would not cause any issues if it had already been called.  Thanks for the reply.

    Imported from legacy forums. Posted by Brian (had 766 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.