make closing event handler which calls your msgbox but also cancels the closing event by default.
private void My_FormClosing(object sender, FormClosingEventArgs e)
{
MyMsgBox.ShowBox("Exit?","Error","ok","cancel");
e.cancel;
}
add this method to this.formclosing event as handler
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(My_FormClosing);
now inside method, if the user presses the cancel button, your closing event will stopped by the line "e.cancel", but if user clicks okay button, as you have coded, application will exit