>When the textbox has focus and i click on a button on the form, the messagebox appears, and the click event of the button is not executed if i click ok on the messagebox. When pressing the space key the messagebox dissapears and the click event is executed.
Your click event shouldn't be firing in either case (whether you click OK in messagebox or hit spacebar). I tried it in both 3.0 and 5.0 and in both cases (clicking OK or hitting space bar when OK had focus in messagebox) and in both versions, the command button that I attempted to click merely received focus (but the click event didn't fire). Whether or not it SHOULD is another question! I'm not sure why in your situation that pressing the spacebar in the messagebox allowed the Click event in the button you attempted to click fire!