I have a datagridview, connected to my database using Nhibernate and my question is how can I exit the Select Mode after I update? Cause at the moment after I click update and it updates, the edit mode is still on, I would wanna turn it off when I successfully update.

NHibernate is an object-relational mapping (ORM) solution for the Microsoft .NET from WiKiPedia.

I am using it to map my tables and views to the application.

Do you mean want to make the DataGridView un-editable ?

If so do the following:

dataGridView1.Enabled = false;

It stops the user from being able to use the DGV and then you can implement an "Edit" button whitch sets "Enabled" to "true".

DataGridView.EditIndex = -1; Seems to do the trick ^^.