You cannot display a Message box while a BeginUpdate is open.
You can use code like
grid.beginupdate()
//...
while(grid.Updating)
grid.CancelUpdate();
msgbox("Hello World")
to make sure there is not an open BeginUpdate when you try to display a MessageBox.